Python面试:复制一个文件

# 读取文件内容
with open('23052023.docx', 'rb') as file:
    a = file.read()

# 写入一个新文档
with open('copyfile.docx', 'wb') as file:
    file.write(a)

你可能感兴趣的:(Python,python)