formatting numbers

Daniel Klein danielk at aracnet.com
Tue Jun 5 11:13:55 EDT 2001


On Mon, 04 Jun 2001 20:21:30 GMT, "michael montagne" <montagne at boora.com> wrote:

>Simple question.  I am accessing a database of job numbers that take the
>form of "00049" and "01049".  These values are integers.  When I return the
>value from the database it reads "49".  I need to add the leading digits if
>they are there so this number would read "00049".  In MSAccess I used
>Format(num,"00000").  How can I do that with Python?

>>> print '%05d' % 49
00049

HTH,
Dan



More information about the Python-list mailing list