我有一些类似于以下内容的输入:
str= '159,"10,000+",Free,0,Everyone,Art & Design,"January 7, 2018" '
我想基于逗号分割此字符串,而不是基于双引号“
中的逗号当我使用基于逗号的split
方法时:
new_str = str.split(',')
print(new_str)
['159', '"10', '000+"', 'Free', '0', 'Everyone', 'Art & Design',
'"January 7', ' 2018"']
我想使用split
方法,输出应为:
['159', '"10,000+"', 'Free', '0', 'Everyone', 'Art & Design',
'"January 7,2018"']