python json dumps

前端 未结 4 1009
予麋鹿
予麋鹿 2020-12-15 17:46

i have the following string, need to turn it into a list without u\'\':

my_str = \"[{u\'name\': u\'squats\', u\'wrs\': [[u\'99\', 8]], u\'id\': 2}]\"
         


        
4条回答
  •  -上瘾入骨i
    2020-12-15 18:09

    This works but doesn't seem too elegant

    import json
    json.dumps(json.JSONDecoder().decode(str_w_quotes))
    

提交回复
热议问题