i need to rename a multiple files in a folder with numbers increament in python -
i need rename multiple files folder numbers increament in python.i.e. first file in folder gets renamed 1 , second file name 2.like that..how solve this
you should first iterate through files in directory, , rename files.
it might this:
import os # let's want rename files in current directory index = 1 filename in os.listdir(os.getcwd()): os.rename(filename, '_'.join([str(index),filename])) index += 1
this can approach , should adapt needs.
Comments
Post a Comment