Newbie question - leading zeros

Rainy ak at silmarill.org
Fri Oct 13 14:19:32 EDT 2006


eldorado wrote:
> I have looked around and cannot seem to find a way to strip leading zeros
> off of values in a dictionary. Basically, I am looking to do a for loop
> and any value that has one or more leading zeros would be stripped. Any
> pointers would be appreciated. Thanks
>
> --
> Randomly generated signature
> ICMP: The protocol that goes PING!

import string
>>> string.lstrip('0001', '0')
'1'

Hope this willhelp

 -Rainy




More information about the Python-list mailing list