Like this:
num = 60 formatted_num = u'%05d' % num
For more information on formatting numbers as strings, see docs .
If your number is already a string (as your updated question indicates), you can put it with zeros in the right width using the rjust string rjust :
num = u'60' formatted_num = num.rjust(5, u'0')
Cameron Feb 28 2018-11-11T00: 00Z
source share