王员外的博客

分享积累,改变自己

python生成pyc

  • A program doesn't run any faster when it is read from a ‘.pyc’ or ‘.pyo’ file than when it is read from a ‘.py’ file; the only thing that's faster about ‘.pyc’ or ‘.pyo’files is the speed with which they are loaded.
  • When a script is run by giving its name on the command line, the bytecode for the script is never written to a ‘.pyc’ or ‘.pyo’ file. Thus, the startup time of a script may be reduced by moving most of its code to a module and having a small bootstrap script that imports that module. It is also possible to name a ‘.pyc’ or ‘.pyo’file directly on the command line.
在你 import 别的 py 文件时,那个 py 文件会被存一份 pyc 加速下次装载。而主文件因为只需要装载一次就没有存 pyc,你可以写两个 a.py 和 b.py,一个 import 另一个试试看。
阅读更多
个人分类: Python 笔记
上一篇Activity生命周期常见场景的调用过程(牢记于心,方能成大气)
下一篇Application的Theme与Activity的Theme 摘要
想对作者说点什么? 我来说一句

py 转pyc

原文

yuliangxiaohui yuliangxiaohui

2018-06-19 08:57:27

阅读数:11

没有更多推荐了,返回首页

关闭
关闭