我遇到了python的问题,需要一些帮助.当调用任何函数时,它不再显示输出,而是<function hello at 0x0000000002CD2198>(hello是函数名).我重新安装了Python,但问题仍然存在.前几天很好,开始似乎没有理由发生.
我该如何解决这个问题?
你需要调用你的函数,你只打印函数对象本身:
>>> def hello():
... return "Hello World"
...
>>> print hello()
Hello World
>>> print hello
<function hello at 0x1062ce7d0>
Run Code Online (Sandbox Code Playgroud)
注意hello和hello()线之间的区别.
| 归档时间: |
|
| 查看次数: |
124 次 |
| 最近记录: |