open 函数
file object = open(file_name [, access_mode][, buffering])
如:
file object = open('D:/BOOK/123.txt',mode='r',encoding='utf-8)
最常用的是:
r、w、rb、wb
打开后不要忘记关闭
具体操作如下:
book=open('D:/book/book.xlsx',mode='w',encoding='utf-8')
test1=book.write('测试 成功')
book.close()