Read the documentation of os module to find suitable command and use a loop and string formatting to do zero padded number:
print('%03i.txt' % 5)
Output:
005.txt
pyTony
pyMod
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
Meister snippsat's solution is easy, but be careful, it will rename any .png file in the directory. You might want to make sure that the name starts with an integer at least.
Lardmeister
Posting Virtuoso
1,938 posts since Mar 2007
Reputation Points: 465
Solved Threads: 72
Skill Endorsements: 5
Implement it yourself
from __future__ import generators # does your python need this ?
def enumerate(iterable, start=0):
i = start - 1
for item in iterable:
i += 1
yield (i, item)
Gribouillis
Posting Maven
3,101 posts since Jul 2008
Reputation Points: 1,130
Solved Threads: 761
Skill Endorsements: 11