How do I copy a file in Python?

前端 未结 16 2251
隐瞒了意图╮
隐瞒了意图╮ 2020-11-21 07:12

How do I copy a file in Python?

I couldn\'t find anything under os.

16条回答
  •  醉酒成梦
    2020-11-21 07:52

    open(destination, 'wb').write(open(source, 'rb').read())
    

    Open the source file in read mode, and write to destination file in write mode.

提交回复
热议问题