如果我想拆分由分隔符分隔的单词列表,我可以使用
>>> 'abc,foo,bar'.split(',')
['abc', 'foo', 'bar']
但是,如果我还想处理可以包含定界符的带引号的字符串,如何轻松、快速地做同样的事情呢?
In: 'abc,"a string, with a comma","another, one"'
Out: ['abc', 'a string, with a comma', 'another, one']
相关问题:How can i parse a comma delimited string into a list (caveat)?
https://stackoverflow.com/questions/330900
复制相似问题