json反序列化
阿新 • • 發佈:2018-04-01
ads json text pos hello int tex ext 反序
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Random_lee
# import json
#
# f=open(‘test.text‘,‘r‘)
#
# data=json.loads(f.read())
# print(data[‘age‘])
import pickle
def sayhai(name):
print(‘hello‘,name)
print(‘hello2‘,name)
f=open(‘test.text‘,‘br‘)
data=pickle.loads(f.read())
print(data[‘func‘](‘randomelee‘))
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Random_lee
import pickle
def sayhai(name):
print(‘hello‘,name)
f=open(‘test1.text‘,‘rb‘)
data=pickle.load(f) #data=pickle.loads(f.read())
print(data[‘age‘])
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Random_lee
# import pickle
import json
# def sayhai(name):
# print(‘hello‘,name)
f=open(‘test3.text‘,‘r‘)
data=json.loads(f.read())
print(data[‘age‘])
json反序列化