码迷,mamicode.com
首页 > Web开发 > 详细

json反序列化

时间:2018-04-01 14:29:42      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:random   data   pytho   func   pos   hello   序列   UNC   pickle   

#!/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反序列化

标签:random   data   pytho   func   pos   hello   序列   UNC   pickle   

原文地址:https://www.cnblogs.com/randomlee/p/8686193.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!