I want to convert a string into dictionary. I've tried eval
and literal_eval
it doesn't work, since there are no quotes for keys.
str_to_convert = "{rpd.col_A : 'Type B', rpd_dev : 'Other, specify', rpd_form : 'Other'}"
Please note that rpd_dev: 'Other, specify', there is comma within the string which needs to be preserved. How can I achieve this in python?