A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://reference.wolfram.com/language/workflow/EvaluateAWolframLanguageExpressionFromPython.html below:

Evaluate a Wolfram Language Expression from Python—Wolfram Documentation

WOLFRAM Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

WolframConsulting.com

Evaluate a Wolfram Language Expression from Python

Evaluate local Wolfram Language code directly from Python with a persistent kernel session.

Using a Wolfram notebook... Create a local Wolfram Language session

Import the module:

from wolframclient.evaluation import WolframLanguageSession

Create a session using the default path:

session = WolframLanguageSession() Evaluate Wolfram Language expressions

Import the function:

from wolframclient.language import wlexpr

Compute the squares of an array of integers:

session.evaluate(wlexpr('Map[#^2 &, Range[5]]')) End the the session

Terminate the session object:

Using a Jupyter notebook... Create a local Wolfram Language session

Import the module:

Create a session using the default path:

Evaluate Wolfram Language expressions

Import the function:

Compute the squares of an array of integers:

End the the session

Terminate the session object:

Using the command line... Create a local Wolfram Language session

Open a terminal window and invoke the Python interpreter:

Import the module:

>>> from wolframclient.evaluation import WolframLanguageSession

Create a session using the default path:

>>> session = WolframLanguageSession()
Evaluate Wolfram Language expressions

Import the function:

>>> from wolframclient.language import wlexpr

Compute the squares of an array of integers:

>>> session.evaluate(wlexpr('Map[#^2 &, Range[5]]')) 
[1, 4, 9, 16, 25]
End the the session

Terminate the session object:

Exit the Python shell:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4