. py files contain the source code of a program. Whereas, . pyc file contains the bytecode of your program.
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.
pyc files are created by the Python interpreter when a . py file is imported. They contain the "compiled bytecode" of the imported module/program so that the "translation" from source code to bytecode (which only needs to be done once) can be skipped on subsequent imports if the . pyc is newer than the corresponding .
Yes, it is possible.
.pyc
contain the compiled bytecode of Python source files. The Python interpreter loads .pyc
files before .py
files, so if they're present, it can save some time by not having to re-compile the Python source code. You can get rid of them if you want, but they don't cause problems, they're not big, and they may save some time when running programs.
Python compiles the .py
and saves files as .pyc
so it can reference them in subsequent invocations.
There's no harm in deleting them, but they will save compilation time if you're doing lots of processing.
"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. "
http://docs.python.org/release/1.5.1p1/tut/node43.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With