I need to rename the whole images I have in a folder
img1.jpg
to be 1.jpg
i tried like that
import os
s = open('images', 'w')
DIRECTORY = '/img/11/'
for img_filename in os.listdir(DIRECTORY):
x = os.path.splitext(img_filename)[0].split('jpeg')
x = img_filename.replace('img_', '')
s.write(str(x) + '\n')
but need the changes on the files itself