python -- 模块pickletools测试
2019-04-15 19:18发布
生成海报
#! /usr/bin/env python3
# filename : modules.py
# author : zoujiameng@aliyun.com.cn
import pickletools
def protocol_version(file_object):
maxproto = -1
count = 0
for opcode, arg, pos in pickletools.genops(file_object):
maxproto = max(maxproto, opcode.proto)
count += 1
print("count = " + str(count))
return maxproto
r'''
def opcode_print(file_object):
for opcode, arg, pos in pickletools.genops(file_object):
print(opcode.name, opcode.code, opcode.arg, opcode.stack_before, opcode.stack_after, opcode.proto, opcode.doc)
print(arg)
print(pos)
print("--------------")'''
with open('x.pickle', 'rb') as f:
v=protocol_version(f)
print(v)
vv = opcode_print(f)
G
M
T
文本转语音功能仅限200个字符
选项 :
历史 :
反馈 :
Donate
关闭
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮