我想写一个csv列表中的一些项目,这些项目是在引号和逗号之间。我如何写它们,使项目不因逗号而分开?我看了许多类似的问题,但没有找到我的问题的具体解决办法
['Saks, Lord & Taylor data breach may affect 5 million customers', (u'By Mike Murphy', u'April 1, 2018, 5:24 p.m. EST')]
['Why The China Hustle is a finance documentary all U.S. investors need to see', (u'By MarketWatch', u'NewsWatch')]
['Trump says no deal for Dreamers, again threatens to end Nafta in Easter tweets', (u'By Mike Murphy', u'April 1, 2018, 4:49 p.m. EST')]
预期答案:
first column = 'Saks, Lord & Taylor data breach may affect 5 million customers'
'Why The China Hustle is a finance documentary all U.S. investors need to see'
'Trump says no deal for Dreamers, again threatens to end Nafta in Easter tweets'
second column = 'By Mike Murphy'
'By MarketWatch'
'By Mike Murphy'
third column = 'April 1, 2018, 5:24 p.m. EST'
'NewsWatch'
'April 1, 2018, 4:49 p.m. EST'
这个怎么样
简单到:
注
csv
中没有引用“为什么中国…”,因为它不包含任何逗号。如果要引用它,可以在writer
构造函数中使用quoting=QUOTE_ALL
相关问题 更多 >
编程相关推荐