您如何将德语文本写入CSV文件?

问题描述 投票:0回答:2

我正在尝试将从德国网站上抓取的文字写成CSV文件。我试过这样使用UTF-8编码:

with open('/Users/filepath/result.csv', 'a', encoding='utf8') as f:f.write(text)

但是这是CSV文件中显示的内容,而不是ü:

Projekt für Alleinerziehende mit mehreren (behinderten) Kindern

python selenium file web-scraping utf
2个回答
0
投票

尝试使用ISO-8859-15编码。还请确保在编辑器中打开文件时,其编码设置为相同的编码。


0
投票

您必须使用相同的编码进行读写(您可能使用latin1进行了读取。]

© www.soinside.com 2019 - 2024. All rights reserved.