logo-MindMajix
PostPythonPython
H
Harshel Mike

Posted on 21st July 2024|17 views

0
votes

Python Overwrite File

How can I move and overwrite a file in python?

1 answers
Answers
P
Anusha V

Posted on 21st July 2024| views

Moving a fine into a dictionary where there is another file with the same file name is called overwriting a destination file with the brand new source file.

Like this:

src_file = "/mindmajix/run/src_folder/example.txt"

dst_path = "/mindmajix/run/dst_folder/example.txt"

shutil.move(src_file, dst_path)

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number