Fichier de renommée Python
import os
os.rename('guru99.txt','career.guru99.txt')
Cirex
import os
os.rename('guru99.txt','career.guru99.txt')
import os
os.rename('old_name.txt','new_name.txt')
import os
old_file_name = "/home/career_karma/raw_data.csv"
new_file_name = "/home/career_karma/old_data.csv"
os.rename(old_file_name, new_file_name)
print("File renamed!")
import os
os.rename(r'C:\Users\Ron\Desktop\Test\Products.txt',r'C:\Users\Ron\Desktop\Test\Shipped Products.txt')
import os
os.rename('a.txt', 'b.kml')'
# for multiple files
import os
for dirname in os.listdir("."):
print((dirname[:-4]).zfill(6)+'.txt')
os.rename(dirname, (dirname[:-4]).zfill(6)+'.txt')