I want to build a function in Python 3, which gets a name from a text file as a parameter and creates a new .txt file, named double.txt, which is the copy of the first one. How do I do this?
I want to build a function in Python 3, which gets a name from a text file as a parameter and creates a new .txt file, named double.txt, which is the copy of the first one. How do I do this?
import shutil
shutil.copy2(src, dst)
src
and dst
are paths, where src
is the current file and dst
is the copy path of the file
Doc: shutil
Related Answer: stackoverflow