调用函数显示输出<function hello at 0x0000000002CD2198>

use*_*719 2 python function

我遇到了python的问题,需要一些帮助.当调用任何函数时,它不再显示输出,而是<function hello at 0x0000000002CD2198>(hello是函数名).我重新安装了Python,但问题仍然存在.前几天很好,开始似乎没有理由发生.

我该如何解决这个问题?

Mar*_*ers 8

你需要调用你的函数,你只打印函数对象本身:

>>> def hello():
...    return "Hello World"
...
>>> print hello()
Hello World
>>> print hello
<function hello at 0x1062ce7d0>
Run Code Online (Sandbox Code Playgroud)

注意hellohello()线之间的区别.