How do I copy a file in Python?

前端 未结 16 2645
隐瞒了意图╮
隐瞒了意图╮ 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:53

    You could use os.system('cp nameoffilegeneratedbyprogram /otherdirectory/')

    or as I did it,

    os.system('cp '+ rawfile + ' rawdata.dat')
    

    where rawfile is the name that I had generated inside the program.

    This is a Linux only solution

提交回复
热议问题