placid <[EMAIL PROTECTED]> wrote: > Hi all, > > Just wondering if there is a better way of generating a 4 digit number > (that gets converted to a string), ive got the following code which > generates strings between 0000-9999. > > <code> > > for a in range(0,10): > for b in range(0,10): > for c in range(0,10): > for d in range(0,10): > print "%s%s%s%s" %(str(a), str(b), str(c),str(d)
for n in xrange(10000): print "%4.4d" % n Alex -- http://mail.python.org/mailman/listinfo/python-list