import os
a = 'test2'
path = './images/%s' % a
files = os.listdir(path)
i = 0
for file in files:
# print(path + '/' + file)
old_name = path + '/' + file
new_name = path + '/' + '%s' % i + '.png'
os.rename(old_name, new_name)
i += 1