0

我想将字符串转换为字典。我试过了evalliteral_eval但它不起作用,因为键没有引号。

str_to_convert = "{rpd.col_A : 'Type B', rpd_dev : 'Other, specify', rpd_form : 'Other'}"

请注意 rpd_dev: 'Other, specify',字符串中有逗号,需要保留。我怎样才能在python中实现这一点?

4

0 回答 0