Python os.replace Function
The os.replace function in Python’s os module is used to rename or move a file or directory. If the destination exists, it will be replaced. This function is similar to os.rename, but it ensures that the operation is atomic.