How to split a string by commas positioned outside of parenthesis?

前端 未结 10 2081
南方客
南方客 2020-11-27 19:36

I got a string of such format:

\"Wilbur Smith (Billy, son of John), Eddie Murphy (John), Elvis Presley, Jane Doe (Jane Doe)\"

so basicly i

10条回答
  •  难免孤独
    2020-11-27 20:06

    I think the best way to approach this would be to use python's built-in csv module.

    Because the csv module only allows a one character quotechar, you would need to do a replace on your inputs to convert () to something like | or ". Then make sure you are using an appropriate dialect and off you go.

提交回复
热议问题