【发布时间】:2015-10-20 14:11:32
【问题描述】:
我正在尝试在 python 中制作一个简单的计时器脚本。我看到很多其他人也有这个错误,但我认为我的错误可能会有所不同,因为我是 python 新手:
time=60
from time import sleep
while (time>0):
print ("you have") (time) ("seconds left")
time-=1
sleep(1)
结果如下:
>>>
you have
Traceback (most recent call last):
File "H:\counter.py", line 4, in <module>
print ("you have") (time) ("seconds left")
TypeError: 'NoneType' object is not callable
谁能发现这个错误? 使用 %s 以及在时间变量周围使用 +'s 和 str() 也让我失败了
【问题讨论】: