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!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

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

Okay