How to compile a Python program using the py_compile module
kw.py
a,b=10,20
(a,b)=(b,a)
print(a,b)
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__$ 
Advertisement