我有一个示例 csv 文件包含
col1
"hello \n
world"
"the quick \njump
\n \r \t brown fox"
示例代码转换为 tsv
import pandas as pd
df = read_csv(r'a.csv')
df.to_csv('data.tsv', sep='\t', encoding='utf-8', escapechar='\n')
预期结果将是
col1
"hello \n world"
"the quick \njump \n \r \t brown fox"
但结果会是
col1
"hello \n
world"
"the quick \njump
\n \r \t brown fox"