What would be the best way to increment a value that contains leading zeroes? For example, I\'d like to increment \"00000001\". However, it should be noted that the number of
Presumably, you specifically mean an integer represented as a string with leading zeros?
If that's the case, I'd do it thusly:
>>> a '00000000000000099' >>> l = len(a) >>> b = int(a)+1 >>> b 100 >>> ("%0"+"%dd" % l) % b '00000000000000100'