Force Overwrite in Os.Rename
python
Solution
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`:
from os import remove
from shutil import move
remove('C:\\Users\\Tests.csv')
move('C:\\Users\\Test.txt', 'C:\\Users\\Tests.csv')
Problem
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 replaced by the Tests.txt file (that was also renamed to Tests.csv). ``` os.rename("C:\Users\Test.txt","C:\Users\Tests.csv"); ```