gpt4 book ai didi

python - UTF8 Python Material list

转载 作者:行者123 更新时间:2023-11-28 20:26:17 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Write to utf-8 file in python

我有 Unicode 字符串(带有日语字符)我想写入 CSV 文件。不过BOM好像没写对,第一行是一个字符串""。这会导致 Excel 无法正确显示日语字符。用Notepad++打开CSV时,字符显示正确。

fileObj = codecs.open(filename,"w",'utf-8')
fileObj.write(codecs.BOM_UTF8)
c = u';'
for s in stringsToWrite:
line = e.someUnicodeString
fileObj.write(line)
fileObj.close()

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com