x=5
print(eval('x+1',{'__builtins__': None}))
Getting Error:
TypeError: 'NoneType' object is not subscriptable
Why am I getting above error?
Also, How to specify only a few built-in methods for eval() function? For example, allowing only max
and min
functions.