Answers for "how to move a txt file in python"

3

how to move a txt file in python

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")
Posted by: Guest on November-04-2020

Code answers related to "how to move a txt file in python"

Python Answers by Framework

Browse Popular Code Answers by Language