Python 读写文件 中文乱码 错误TypeError: write() argument must be str, not bytes+

今天使用Python向文件中写入中文乱码,代码以下:web fo = open("temp.txt", "w+") str = '中文' fo.write(str) fo.close() 后来指定写入字符串的编码格式为UTF-8,出现错误TypeError: write() argument must be str, not bytessvg fo = open("temp.txt", "w+")
相关文章
相关标签/搜索