python读取带有中文字符串文件和
写入带有中文字符串的文件:
读取文件:
with open('file.txt', 'r', encoding='utf-8') as f:
content = f.read()
写入文件:
with open('file.txt', 'w', encoding='utf-8') as f:
f.write('中文字符串')
原文地址: https://www.cveoy.top/t/topic/blN5 著作权归作者所有。请勿转载和采集!