[Tutor] long-to-string

Jimmy verma jim_938 at hotmail.com
Mon Oct 20 15:32:39 EDT 2003


Thanks a lot for responding.  I am able to get what i was looking for. I 
have packed the long no again in order to get the required string. Can you 
please explain a bit more on this. Though I got the result but have not 
understood properly why it happened. I converted my string to a long with 
the function i wrote. and same thing can be done with unpack.


>The conversion to a long (which you already did) can also be
>written as:
> >>> struct.unpack( ">l", 'oMAP' )
>(1867333968,)



>
>and since we only want the first thing, we write:
> >>> struct.unpack( ">l", 'oMAP' )[0]
>1867333968
>
>Which leads me to think that the conversion from a long to the
>string could be expressed as:
> >>> struct.pack( ">l", 1867333968 )
>'oMAP'

What happened here???? Not fully clear!!!

Waiting for your expert suggestions.

Thanks again for your kind support.


With best regards,

James

PS:  Sorry for a bit of hurry in sending my mail again.

_________________________________________________________________
Buy now! Receive a gold coin on Dhan Teras. 
http://server1.msn.co.in/features/general/dhanteras/index.asp Celebrate 
prosperity!




More information about the Tutor mailing list