简体   繁体   English

查找和替换引号之间的逗号

[英]Find and replace commas between quotation marks

I have a string我有一个字符串

line='Aaron JamesNorman662018,1956,Aaron James,Norman,Aaron,Aaron James,Pangea Ventures,Zone 20,Field,Parkwest,"Director,Human Resourse",Leasing Agent 2 (L2),DeLana Watson,2018-06-06,2019-09-27 00:00:00,Terminated'

I need to remove the comma between the double quote, in this case is the comma between 'Director' and 'Human Resource'.我需要删除双引号之间的逗号,在这种情况下是“Director”和“Human Resource”之间的逗号。

Thanks谢谢

I think this re works for my case我认为这适用于我的情况

line=re.sub(r'(?!(([^"] "){2}) [^"]*$),', '', line) line=re.sub(r'(?!(([^"] "){2}) [^"]*$),', '', line)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM