Need help on left padding

R

rajesh kataraki

Hello,

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.

The snippet of string is as follows:

container_name = "%s-%d-dso-%s.so" % (platform_affix,var, rteset)


Please let me know how can I implement this efficiently in python
language.

Need help urgent.

Thanks,
-Rajesh
 
M

Marc 'BlackJack' Rintsch

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top