Ask Question
5 June, 08:02

How do i move a file in python3

+1
Answers (1)
  1. 5 June, 08:22
    0
    To move a file in Python, we will need to import the os and shutil modules that provide us the ability to copy, move, and remove files in Python. Both of these modules provide methods to do so, although in many cases the shutil module has more convenient methods.

    Keep in mind that the destination directory needs to exist in order for this example to work. Once you've set up the directories "d1" and "d2" (or just changed the example to fit your directory structure), run the code. Now check out the "d2" directory and you should see the xfile. txt if now present in that directory.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “How do i move a file in python3 ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers