Python

Python Menu

Python

Python eval() Function - Definition, Syntax, Parameters, Examples

Definition

The eval() function evaluates the specified expression, provided it is a legal Python statement.

Syntax

eval(expression, globals, locals)

Parameters

Parameter Description
expression A String, that will be evaluated as Python code
globals Optional. A dictionary containing global parameters
locals* Optional. A dictionary containing local parameters

Example:

myString = 'print("Evaluate Me.")' eval(myString)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods