我有一个字符串:
u'{"nick":"NICK","name":"NAME","email":"name@example.com","phone_gsm":"","phone":"","birthday":"","location":"UK","address":"","job":"","gender":"male","permission_of_contact":"NO"}'
我需要获取正确的数据,因此我需要获取用户的昵称,用户的电子邮件等。有没有办法获取它们?
谢谢。
答案 0 :(得分:3)
使用json模块
import json
my string = u'{"nick":"NICK","name":"NAME","email":"name@example.com","phone_gsm":"","phone":"","birthday":"","location":"UK","address":"","job":"","gender":"male","permission_of_contact":"NO"}'
data = json.loads(my_string)