python3写入文件由于编码问题报错

在字符串写入文件时,有时会因编码问题导致无法写入,可在open方法中指定encoding参数

fp= open(filename, 'w', encoding='utf-8')
转自:https://www.cnblogs.com/stuqx/p/7291973.html

猜你喜欢

转载自blog.csdn.net/Andrew_jdw/article/details/78929571