DEV Community

saurabh belote
saurabh belote

Posted on

1

python program to copy file

from shutil import copyfile
copyfile("/root/a.txt", "/root/b.txt")
Enter fullscreen mode Exit fullscreen mode

Top comments (3)

Collapse
 
rocketmaker69 profile image
RocketMaker69

or:

fa = open("root/a.txt", "r").read()
fb = open("root/b.txt", "w")
fb.write(fa)

Collapse
 
s_belote_dev profile image
saurabh belote

Thanks for sharing

Collapse
 
rocketmaker69 profile image
RocketMaker69

you're welcome!

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay