I have a data set of the format key1=value1, key2=value2, key3=value3... where each key-value pair is separated from the others by a ", ".
However, some values are long strings that contain ", " as part of the value.
How can I correctly go through this data and convert it to csv?
I've tried using a csv.reader, but it doesn't work.
data = row.lstrip('(').rstrip(')\n')
reader = csv.reader(StringIO(data))
for row2 in reader:
my_dict = {}
for d in row2:
my_dict[d.split('=')[0].lstrip()] = d.split('=', 1)[1]