String to int newbie question
Rene Pijlman
reply.in at the.newsgroup
Sat Mar 22 08:44:55 EST 2003
More information about the Python-list mailing list
Sat Mar 22 08:44:55 EST 2003
- Previous message (by thread): String to int newbie question
- Next message (by thread): String to int newbie question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Boris Genz: >I want to convert a number string ( '3211' for example ) to a number, >( actually integer ) preserving the original number Is there any other way? >( the exact number being string and integer ) Que? >but if my number string starts with one or more zeroes, >then the numbers won't be same... Yes they will. '0027' and '027' both convert to 27. >For example, if I have string = '0027' then int(string) would give 27. >How can I add leading zeroes to that number? By not converting it to an integer. It already had leading zeroes before you converted it :-) 0027 == 027 == 27 -- René Pijlman
- Previous message (by thread): String to int newbie question
- Next message (by thread): String to int newbie question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list