Built-in function | SoloLearn: Learn to code for FREE!

+1

Built-in function

What excec function do in python?

4/30/2018 10:36:00 AM

HBhZ_C

3 Answers

New Answer

+3

exec() in Python exec() function is used for the dynamic execution of Python program which can either be a string or object code. If it is a string, the string is parsed as a suite of Python statements which is then executed unless a syntax error occurs and if it is an object code, it is simply executed. We must be careful that the return statements may not be used outside of function definitions not even within the context of code passed to the exec() function. It doesn;t returnn any value, hence returns None. Check this interactive tutorial: https://www.geeksforgeeks.org/exec-in-python/

+2

You're welcome!

+1

Thanks a lot Johannes