api.printing.pycode#
Functions#
|
Converts an expr to a string of Python code |
Classes#
|
Details#
- pycode(expr, **settings)[source]#
Converts an expr to a string of Python code
- Parameters:
- exprExpr
A SymPy expression.
- fully_qualified_modulesbool
Whether or not to write out full module names of functions (
math.sin
vs.sin
). default:True
.- enable_dependencies: bool
Whether or not to print dependencies too (EvalField, Kernel, etc)
Examples
>>> from sympy import tan, Symbol >>> from sympy.printing.pycode import pycode >>> pycode(tan(Symbol('x')) + 1) 'math.tan(x) + 1'