I am using the range function tomake a list of jpgs between 1 and 200 but want there to be leading zeros in the list.
My current code is like this.
the result is as follows:
000.jpg
001.jpg
etc.
It basically adds the leading zeros in three different steps. It works but I wanted to know if there is a more elegant solution.
Thanks
My current code is like this.
Code:
myList=[]
for i in range (0,10):
myList.append (("00%s.jpg)%(i))
for i in range (10,100):
myList.append (("0%s.jpg)%(i))
for i in range (100,200):
myList.append (("%s.jpg)%(i))
000.jpg
001.jpg
etc.
It basically adds the leading zeros in three different steps. It works but I wanted to know if there is a more elegant solution.
Thanks
Comment