Is it possible to force a rename os.rename to overwrite another file if it already exists? For example in the code below if the file Tests.csv already exists it would be re
You could try shutil.move():
from shutil import move move('C:\\Users\\Test.txt', 'C:\\Users\\Tests.csv')
Or os.remove and then shutil.move:
os.remove
shutil.move
from os import remove from shutil import move remove('C:\\Users\\Tests.csv') move('C:\\Users\\Test.txt', 'C:\\Users\\Tests.csv')