0

As you see, I use csv.DictReader to read csv in python.

dr = DictReader(open(csv, encoding='utf-8', mode='r'))
for row in dr:
    print(row)

the input csv is like:

id,name,type,skill
0,光,支援型,简单 - 音符流失后的回忆率丢失程度减小
1,对立,平衡型,-
2,红,平衡型,-\n(觉醒)以歌曲结算成绩为基准值获得最高 +20% 的残片奖励

when I run it, it shows:

{'id': '1', 'name': '对立', 'type': '平衡型', 'skill': '-'}
{'id': '2', 'name': '红', 'type': '平衡型', 'skill': '-\\n(觉醒)以歌曲结算成绩为基准值获得最高 +20% 的残片奖励'}

the problem is that I want \n to be parsed to EOL, but it turns it to \n. How can I avoid it?

Player01
  • 13
  • 3

0 Answers0