摘要: 闭包函数必须有内嵌函数 内嵌函数需要引用该嵌套函数上一级变量 闭包函数必须返回内嵌函数 阅读全文
posted @ 2017-09-04 21:42 zy-- 阅读(222) 评论(0) 推荐(0)
摘要: #z装饰器import timedef deco(func): def wrapper(): startT = time.time() func() endT = time.time() msecs = (endT - startT)*1000 print("it's %f ms" % msecs) 阅读全文
posted @ 2017-09-04 17:58 zy-- 阅读(99) 评论(0) 推荐(0)
摘要: import os import sys modulepath = os.getcwd () + '\\module' sys.path.append(modulepath) 阅读全文
posted @ 2017-09-04 15:58 zy-- 阅读(167) 评论(0) 推荐(0)
摘要: *.pyc 命令:python - m py_comple file.py 脚本: import py_compile py_compile.compile('module.py' , 'module.pyc') *.pyo 或 opt 命令:python - O - m py_compile mo 阅读全文
posted @ 2017-09-04 15:39 zy-- 阅读(188) 评论(0) 推荐(0)
摘要: import 模块名字 import 模块名字 as 别名 from 模块名 import 函数/类名/ * 阅读全文
posted @ 2017-09-04 15:33 zy-- 阅读(140) 评论(0) 推荐(0)