[plug] [OT] Adding leading zeros in python

rpowersau at gmail.com rpowersau at gmail.com
Tue Dec 21 17:26:55 WST 2004


Thanks mate, that did it.

Too easy.  :)


On Tue, 21 Dec 2004 16:55:35 +0800, Cameron Patrick
<cameron at patrick.wattle.id.au> wrote:
> rpowersau at gmail.com wrote:
> 
> > >>> for i in range(1,21):
> > ...   localf = 'file%2s' %i
> 
> Try 'file%.2d' (note the decimal point).  It's almost the same as C
> printf format strings, so man 3 printf may be of use (as well as the
> Python on-line docs).
> 
> Cameron.
> 
> _______________________________________________
> PLUG discussion list: plug at plug.linux.org.au
> http://spark.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
> 


-- 
Regards,
Russ



More information about the plug mailing list