python 2.7 code
cStr = \'\"aaaa\",\"bbbb\",\"ccc,ffffd\"\'
newStr = cStr.split(\',\')
print newStr
# result : [\'\"aaaa\"\',\'\"bbbb\"\',\'\"ccc\',\'ffffd\
It will be better to use regex in this case.
re.findall('".*?"', cStr)
returns exactly what you need
asterisk is greedy wildcard, if you used '".*"'
, it would return maximal match, i.e. everything in between the very first and the very last double quote. The question mark makes it non greedy, so '".*?"'
returns the smallest possible match.
You need a parser. You can build your own, or you may be able to press one of the library ones into service. In this case, json
could be (ab)used.
import json
cStr = '"aaaa","bbbb","ccc,ffffd"'
jstr = '[' + cStr + ']'
result = json.loads( jstr) # ['aaaa', 'bbbb', 'ccc,ffffd']
result = [ '"'+r+'"' for r in result ] # ['"aaaa"', '"bbbb"', '"ccc,ffffd"']