How do I get an integer to fill 0\'s to a fixed width in python 3.2 using the format attribute? Example:
a = 1 print(\'{0:3}\'.format(a))
gives
There is built-in string method .zfill for filling 0-s:
>>> str(42).zfill(5) '00042' >>> str(42).zfill(2) '42'