拆分CSV字段 [英] split CSV fields
本文介绍了拆分CSV字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用 - 保护字段分割CSV行的最简单表达式是什么?
s =''" 123",a,b,\ ; c \"",5.640''
解决方案
s.split('','' );
robert写道:
用 - 保护字段分割CSV行的最简单表达式是什么?
s =''" 123"," a,b,\" c \"",5.640''
robert写道:
用于分割CSV行的最简单表达式
带有-protected字段?
s =''" 123"," a,b,\" c \"",5.640''
导入csv
首选方法是使用该模块读取文件。如果你在处理单行时坚持
,你可以做
cols = list(csv.reader([string]))
< / F>
robert写道:
使用-protected
字段拆分CSV行的最简单表达式是什么?
s =''" 123"," a, b,\" c\"",5.640''
使用csv-module。它应该有一个方言,虽然我不是100%
确定如果逃避从csv POV正确完成。可能是那个
它需要excel-standard。
Diez
What is a most simple expression for splitting a CSV line with "-protected fields?
s=''"123","a,b,\"c\"",5.640''
解决方案
s.split('','');
robert wrote:What is a most simple expression for splitting a CSV line with "-protected fields?
s=''"123","a,b,\"c\"",5.640''
robert wrote:
What is a most simple expression for splitting a CSV line
with "-protected fields?
s=''"123","a,b,\"c\"",5.640''import csv
the preferred way is to read the file using that module. if you insist
on processing a single line, you can do
cols = list(csv.reader([string]))
</F>
robert wrote:
What is a most simple expression for splitting a CSV line with "-protected
fields?
s=''"123","a,b,\"c\"",5.640''Use the csv-module. It should have a dialect for this, albeit I''m not 100%
sure if the escaping of the " is done properly from csv POV. Might be that
it requires excel-standard.
Diez
这篇关于拆分CSV字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文