# Python Bytecode

In the compilation stage, Python first translates source code to a specific **Intermediate Representation (IR)**, and then this IR is converted to machine code. The IR that Python uses is called **Python Bytecode**. The Python Bytecode is stored as `.pyc` file.

When we are given a `.pyc` file, we should try using a Python Bytecode decompiler to get readable source code. For newer versions of Python, use **decompyle3**:

{% embed url="<https://github.com/rocky/python-decompile3>" %}
decompyle3
{% endembed %}

For older versions of Python, use **uncompyle6**:

{% embed url="<https://pypi.org/project/uncompyle6/>" %}
uncompyle6
{% endembed %}

There are some other similar tools for specific Python versions. If the decompiled output does not make sense, always try using other tools.
