We can move our file in Python using the os.rename() method. But you need to be aware that your source and destination file should be in the same disk.
We can also use shutil.move() method to move our file in Python. If your source and destination file are at the different disk in that case also this method works. If the destination file is on the current file system where the resource file is also present then shutil.move() uses os.rename()to move the file. Otherwise, shutil.move() copies the source file to the destination file using shutil.copy2() and then removes the source.
If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.