我正在尝试将 csv 格式转换为 tsv。我只是用它来将逗号更改为制表符。
tsv = re.sub(',', '\t', csv)
但我无法处理里面有逗号的字符串,例如:
dept_no,dt,hello
1,20180411,hello its me
2,20180412,here has tab
3,20180412,"here, is, commas"
Run Code Online (Sandbox Code Playgroud)
有没有什么方法可以转换为 tsv 而不影响字符串内部的逗号?