python get file folder and rename the picture

import os
file = os.listdir('F:/python/')
for i in file:
    if (i.endswith('.jpg')):
        os.rename(i,'1.png')
        print(i)

os.rename (old, new) will be given if there is new.

Guess you like

Origin www.cnblogs.com/liubingzhe/p/11317158.html