我的 csv 文件有一个重大问题,这里有人可以建议我的问题可能的 python 解决方案吗?
在我的 csv 文件中,'remarks' 文本列创建了多个换行符并将其自身附加到下一行,本质上是弄乱了行顺序。我试图将它作为文本阅读,用换行符和分隔符分割它,但这具有挑战性,因为从“备注”创建的换行符的顺序不同。
我附上了下面的示例 csv 文件供您参考,它是 txt 格式,因此您可以更好地了解分隔符格式,您的输入将不胜感激。
当前文件
key1\tkey2\tremarks\tdate_created\tprogram_type\n
1910-ASD3\tT342-1AE2\tJohan has applied for\n
this program on 2020-03-13, good application etc.\tprogram_A\n
9572-45A3\t823A-1T3C\tMary has applied for this program\n
on 2019-03-13, she has doubts about this program\n
so she switched her program on 2019-04-13 etc.\tprogram_B\n
842E-123A\t343D-6TYB\t\tnot enrolled\n
期望的结果
key1\tkey2\tremarks\tdate_created\tprogram_type\n
1910-ASD3\tT342-1AE2\tJohan has applied for this program on 2020-03-13, good application etc.\tprogram_A\n
9572-45A3\t823A-1T3C\tMary has applied for this program on 2019-03-13, she has doubts about this program so she switched her program on 2019-04-13 etc.\tprogram_B\n
842E-123A\t343D-6TYB\t\tnot enrolled\n