[Tutor] How do you turn something into a number?
Lane, Frank L
frank.l.lane at boeing.com
Fri Aug 19 22:37:29 CEST 2005
Not understanding the proper phraseology for my question I can't search
the faq so here goes:
I have what I think is a string from socket.recvfrom(...). I want to
turn it into numbers so I tried:
from socket import *
from array import *
data, address = recvfrom (...stuff...)
s = ""
number =int(s.join(data[10:13],16)) # turn two bytes of the string into
a python number, do this a lot to parse all numbers from
# socket stream
This yaks and says something about improper argument to int. I don't
understand python's type system at all so any help here will be greatly
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor