How do you make a copy of a file with Python? Questions & Answers › Category: Python › How do you make a copy of a file with Python? 0 Vote Up Vote Down Lokesh Kumar Staff asked 2 years ago How do you make a copy of a file with Python? a. copyfile(‘file.txt’, ‘file_copy.txt’) b. import shutil shutil.copyfile(‘file.txt’, ‘file_copy.txt’) c. open(‘file.txt’, ‘file_copy.txt’) d. copy(‘file.txt’, ‘file_copy.txt’) Share this:Click to share on Facebook (Opens in new window)Click to share on Twitter (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to print (Opens in new window)Click to share on LinkedIn (Opens in new window)Click to share on Pinterest (Opens in new window)Like this:Like Loading... Related 1 Answers 0 Vote Up Vote Down Lokesh Kumar Staff answered 2 years ago b. import shutilshutil.copyfile(‘file.txt’, ‘file_copy.txt’) Explanation: shutil.copyfileobj(fsrc, fdst[, length]) – copy the contents of the file-like object fsrc to the file-like object fdst. Share this:Click to share on Facebook (Opens in new window)Click to share on Twitter (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to print (Opens in new window)Click to share on LinkedIn (Opens in new window)Click to share on Pinterest (Opens in new window)Like this:Like Loading... Related