A Python module is automatically compiled into a .pyc file by CPython interpreter. The .pyc file, which contains the bytecode, is in binary format (marshaled code?). Is there a GUI (or command line) tool that let me view the bytecode?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
There's a visual python disassembler called PyChrisanthemum.
To do it the command-line way you can use module
dis
(python 2.7.3, python 3.2.3), as OP already found out.Every *.pyc file is a binary file containing next things:
Why not just use the CPython`s built-in features for this task?
A file
view_pyc_file.py
Tested with next CPython`s versions:
Demonstration
Content of a file
main.py
Create and to read pyc-file by the python2.7
Create and to read pyc-file by the python3.4
Create and to read pyc-file by the python3.5
Based on: