我的代码没有打印执行的代码

My code is not printing the executed code

print(exec("5 + 5"))

它不打印 10 而是打印 None。我确定 exec 基本上执行代码。

执行 returns None。在这种情况下,您可能应该使用 eval()