[Tutor] long-to-string
Jimmy verma
jim_938 at hotmail.com
Sat Oct 18 14:58:47 EDT 2003
Hello,
First of all thanks to tutor for providing their support. People on this
list are really helpful.
Now I would like to discuss something about my problem::
i have written a module to covert a 4 byte string into a long like this:
>>>def makelong(chaine):
... # Make a long form a 4-byte string
... return
((ord(chaine[0])*256+ord(chaine[1]))*256+ord(chaine[2]))*256+ord(chaine[3])
...
>>># Now call the function we just defined:
... makelong('oMAP')
1867333968
I packs this data with struct module
using '>L' format
I am able to unpack this and get the no from my file
Now i want is to convert the no back into the string like 'oXYZ' for which
this no was meant.
I would welcome your suggestions on how should i move ahead.
Thanks in advance.
With best regards,
J+
_________________________________________________________________
MSN Hotmail now on your Mobile phone.
http://server1.msn.co.in/sp03/mobilesms/ Click here.
More information about the Tutor
mailing list