python 把字串轉換成字典
a={"cardtype":"A711","dt":"1447223787","token":"6C7C75327CC6FB4C77051E2BBD85CF5","appdCF" aa5d4d8e8c0f15a197cb9db5 ","imsi":"460011082618869"}
type(a) --> str
1.
b= eval(a) ; type(b) --> dict
2. (a) ;type(c) --> dict
------------------------------------ -------------------------------------------------- ---
把字典型別轉換成json 形式輸出
import json
v1 = json.load(a)
v2 = json.dumps(v1,sort_keys=True,indent=4)
print v
print :
{
"appid": "13a876d53ee4da1a",
"cardtype": "A711",
"dt": "14472237 618869",
"tid": "17bf1867aa5d4d8e8c0f15a197cb9db5",
" token": "6C7C75327CC6FB4C77051E2BBD85CFAF"
}