Type Casting...
Donn Cave
donn at u.washington.edu
Tue Sep 18 15:25:15 EDT 2001
More information about the Python-list mailing list
Tue Sep 18 15:25:15 EDT 2001
- Previous message (by thread): Type Casting...
- Next message (by thread): nntplib and xover
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Quoth David In VA <me at mindspring.com>: | I have a variable that is storing a numeric value. I need the string | representation of that value. I would imagine type casting would be the | thing to use. can someone please tell me how to do this in Python? I see everyone has assumed that you were totally off track and really wanted to render the number in decimal or whatever notation, which I suppose is probably the case. If you actually wanted a string with the same bit value, as you might get with a type casting operation in another language, that bit value will have to be copied to a string anyway - Python doesn't type cast like that. You can use struct.pack(), like struct.pack('!l', n) Donn Cave, donn at u.washington.edu
- Previous message (by thread): Type Casting...
- Next message (by thread): nntplib and xover
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list