I have str that are like \'60\' or \'100\'. I need the str to be \'00060\' and \'00100\',
How can i do this? code is something like this: I was using \'0\'+\'0\'+
Like this:
num = 60
formatted_num = u'%05d' % num
See the docs for more information about formatting numbers as strings.
If your number is already a string (as your updated question indicates), you can pad it with zeros to the right width using the rjust
string method:
num = u'60'
formatted_num = num.rjust(5, u'0')