【Python】字符串字典 转 字典/json字符串
作者:互联网
if __name__ == '__main__': dictStr = "{'A':'aValue'}" print(type(dictStr), dictStr) # 字符串字典 转 字典 print(type(eval(dictStr)), eval(dictStr)) # 字符串字典 转 字符串json print(type(json.dumps(eval(dictStr), ensure_ascii=False)), json.dumps(eval(dictStr), ensure_ascii=False))
标签:__,dictStr,Python,json,eval,字符串,字典 来源: https://www.cnblogs.com/danhuai/p/16362284.html