LaTeX does not support printing Python code with useful markup and format out of box.
This page links to the minted package, which provides a ready-for-use package for CTAN and LaTeX.
This page gives a minimal implementation (only some customization in .tex file, no packages) for marking Python code.
This is a black-and-white version. I don’t use it.
– END –