Need help on left padding

Albert Leibbrandt evlangelis at gmail.com
Mon Apr 28 08:58:51 EDT 2008


Marc 'BlackJack' Rintsch wrote:
> On Mon, 28 Apr 2008 04:37:02 -0700, rajesh kataraki wrote:
>
>   
>>      My requirement is I am using one variable ex. var = 5 which is
>> integer.
>>     And this variable, I m using in some string. But I want this var
>> to be used as 005 again integer in this string.
>>     
>
> In [22]: '%03d' % 5
> Out[22]: '005'
>
> Ciao,
> 	Marc 'BlackJack' Rintsch
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>   
    that or use *str(5).zfill(3)*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080428/a56fbf37/attachment-0001.html>


More information about the Python-list mailing list