move into directory python code example
Example 1: python how move file to directory
import shutil, os
files = ['file1.txt', 'file2.txt', 'file3.txt']
for f in files:
shutil.move(f, 'dest_folder')
Example 2: python cd to directory
import os
os.chdir(path)
Example 3: python cd to file
import os
os.chdir(os.path.dirname(__file__))