How to compile a Python program using the py_compile module
kw.py
Output
kodingwindow@kw:~$ ls kw.csv Desktop Downloads Pictures Templates kw.py Documents Music Public Videos kodingwindow@kw:~$ python3 -m py_compile kw.py kodingwindow@kw:~$ ls kw.csv Desktop Downloads Pictures __pycache__ Videos kw.py Documents Music Public Templates kodingwindow@kw:~$ cd __pycache__/ kodingwindow@kw:~/__pycache__$ ls kw.cpython-312.pyc kodingwindow@kw:~/__pycache__$ python3 kw.cpython-312.pyc 20 10 kodingwindow@kw:~/__pycache__$ cat kw.cpython-312.pyc � �!��*�d\ZZeecZZeee�y))� �N)�a�b�print���kw.py<module>r s"�� ���!����1��a�� kodingwindow@kw:~/__pycache__$
What Next?
How to view the byte code instructions using the dis module
Python program to perform the arithmetic operations
Python program to perform the relational operations
Advertisement