[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
Hello,
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
appreciated.
Thanks,
Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050819/eac1bcfa/attachment-0001.htm
More information about the Tutor
mailing list