How do I execute a statement dynamically in Python?
For ex: assume the value x contains the following expression, (a+b)/2,
a = 1
b = 3
x = (a+b)/2
The value for x will be from a table
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably you want
evalBut it’s usually considered a bad practice (click here for a more elaborate and funnier explanation)