String to int newbie question

Boris Genz boris_genz at hotmail.com
Sat Mar 22 08:37:22 EST 2003


I have the following problem:
I want to convert a number string ( '3211' for example ) to a number, 
( actually integer ) preserving the original number ( the exact number being
string and integer ), but if my number string starts with one or more zeroes,
then the numbers won't be same...
For example, if I have string = '0027' then int(string) would give 27.
How can I add leading zeroes to that number?
I know it's a rather stupid question, but please help...




More information about the Python-list mailing list