I am trying to run this in Python IDLE:
>>> eval(print("123*13"))
I get the output correctly, but it comes with a TypeError
:
123*13
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
eval(print("123*13"))
TypeError: eval() arg 1 must be a string, bytes or code object
NOTE:
I do NOT want to do print(eval("123*13"))
.
I want to use print()
in eval()
function.
This is NOT for actual implementation, but I got this error while using eval()
function. I am not asking this for any actual implementation, but curiosity.