I have string like:
'par1=val1,par2=val2,par3="some text, again some text, again some text",par4="some text",par5=val5'
I have to split it to parts like:
par1=val1
par2=val2
par3="some text, again some text, again some text"
par4="some text"
par5=val5'
I use this code:
a = 'par1=val1,par2=val2,par3="some text1, again some text2, again some text3",par4="some text",par5=val5'.split(',')
newList = []
for i, b in enumerate(a) :
if b.find('=') != -1 :
newList.append(b)
else :
newList[len(newList)-1] += ',' + b
print(newList)
I'm looking for better solution, can anybody give me it.
Thank you in advance!