Python turns strings into dictionaries except for json.loads ()

how to change strings into dictionaries in python except json.loads

see eval on the Internet, but this always reports an error

so this eval is not good?

Mar.31,2021

you can use this:


Python 2.6.3 (r263rc1:75186, Oct  2 2009, 20:40:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.literal_eval("{'a':'a','b':0}")
{'a': 'a', 'b': 0}
>>>

by the way, eval is OK, but ast.literal_eval is more efficient and secure.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3acca-2c257.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3acca-2c257.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?