[Tutor] long-to-string

Jimmy verma jim_938 at hotmail.com
Mon Oct 20 14:41:16 EDT 2003


I hope my message reached properly as i have not recieved any response!!!



>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 'oMAP' 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.
>
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor

_________________________________________________________________
Celebrate Shakti. Send money to loved ones in India. 
http://server1.msn.co.in/sp03/navaratri/ Have a joyous Navratri.




More information about the Tutor mailing list