Re: Number combinations

2006-07-19 Thread Boris Borcic
Tim Chase wrote: ... > If you need the individual digits for something, you can use > > for i in xrange(0,1): > d1,d2,d3,d4 = list("%04i" % i) strings are sequences too, and you need only write d1,d2,d3,d4 = "%04i" % i -- http://mail.python.org/mailman/listinfo/pytho

Re: Number combinations

2006-07-19 Thread Alex Martelli
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 -. > > > > for a in range(0,10): > for b in range(0,10): >

Re: Number combinations

2006-07-19 Thread Bruno Desthuilliers
placid 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 -. > > > > for a in range(0,10): > for b in range(0,10): > for c in range(0,10

Re: Number combinations

2006-07-19 Thread Kevin Watters
How about print ["%04d" % x for x in xrange(1)] -- http://mail.python.org/mailman/listinfo/python-list

Re: Number combinations

2006-07-19 Thread Tim Chase
> 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 -. > > > > for a in range(0,10): > for b in range(0,10): > for c in range(0,10): > for d in r

Number combinations

2006-07-19 Thread placid
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 -. for a in range(0,10): for b in range(0,10): for c in range(0,10): for d in range(0,10):