On 11/01/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote: > time = struct.unpack(">steps+f",c) > adding the f to tell structs it is in float format > > the string substitution > seems like it would work but now I cant figure out how I would add the > f on the end
Did you read up on string substitution? You can do a few tricks with it, but in its simplest form, it just replaces '%s' with the argument. eg: 'foo%sbar' % 'seven' == 'foosevenbar' Or even: 'x%sy%sz' % ('foo', 'bar') == 'xfooybarz' So, in your case, try something like '>%s+f'. > also this still requires me to reassign 6 to steps > > isnt this already done here ? > > >>> s = L[:4] > >>> s > ('\x00', '\x00', '\x00', '\x06') > >>> a = string.join( s , '') > >>> steps = struct.unpack (">l" , a) > >>> steps > (6,) Yes, although in this case steps is a 1-element tuple. So, steps[0] will give you what you want :-) -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor