\documentclass{article}

\usepackage{python}

\usepackage{amsmath} % bmatrix

\begin{document}

$
\begin{python}%
import sympy
print sympy.latex(range(10))
\end{python}%
$

\end{document}

