Python eval() function

Facebooktwitterredditpinterestlinkedinmailby feather Python eval() function The eval() function in Python is used to evaluate the given expression. If the specified expression is a legal Python statement, it will be executed. Syntax

Parameter

expression: This parameter represents a String, that will be evaluated as Python code globals: It is an optional parameter that represents a dictionary containing global parameters locals: It is also an optional parameter that represents a dictionary containing local parameters

Return

This function returns the result of the evaluated expression Example 1 Output Example 2 Output Facebooktwitterredditpinterestlinkedinmailby feather