Split by comma and how to exclude comma from quotes in split

The solution using re.split() function:

import re

cStr=""aaaa","bbbb","ccc,ddd""
newStr = re.split(r',(?=")', cStr)

print newStr

The output:

['"aaaa"', '"bbbb"', '"ccc,ddd"']

,(?=") – lookahead positive assertion, ensures that delimiter , is followed by double quote "

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)