Is there an elegant solution to do this?
I have a counter running from nmin to nmax. I want to convert these numbers to strings of a fixed length.
Let me illustrate it with an example:
for j in range(nmin,nmax):
if j<10:
testval='0000'+str(j)
elif j>9 and j<100:
testval='000'+str(j)
elif .....:
testval=.....
else:
testval='00000'
Although it does the job, I found it rather inelegant. Is there a neater and elegant solution to convert the integer to string of a fixed length?