python move directory code example
Example 1: python move file
import os
import shutil
os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
Example 2: change directory in python os
import os
path = "C:\Users\Your\Directory"
os.chdir(path)
Example 3: change directory in python script
os.chdir(os.path.dirname(__file__))