string-->int
1、10進制string轉化為int
int('12')
2、16進制string轉化為int
int('12', 16)
int-->string
1、int轉化為10進制string
str(18)
2、int轉化為16進制string
hex(18)
json轉化為字典
import json json_str = """ { "id" : 90, "name" : "python", "url" : "http://www.v2ex.com/go/python", "title" : "Python", "title_alternative" : "Python", "topics" : 7646, "stars" : 4862, """ res = json.loads(json_str) print(res['id']) # 90 print(res['name']) # python print(res['url']) # http://www.v2ex.com/go/python