Formatting numbers with leading zeros
Stian
etos at online.no
Sun Sep 19 15:59:21 EDT 2004
Hi, I'm sort of new to Python and I've just discovered the amazing
formatting using the % operator. One thing I can't figure out is how
to format numbers so that they get leading zeros, for example I want
the output 1x01 instead of 1x1 (used in naming my avi files of shows).
I've used this so far:
print '%sx%s'%(season,episode)
which gives the output 1x1, but I want 1x01 =p Any way to format it
using the % method?
More information about the Python-list
mailing list