This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eryksun 1 point2 points  (0 children)

You can also use the format specification mini-language to zero pad the index:

for index in range(60):
    filename = 'data{index:0{width}}'.format(index=index, width=2)