我想在python中做一個簡單的計時器腳本。我看到很多其他人都太有這個錯誤,但我覺得我的錯誤可能會有所不同,因爲我是新來的Python:python錯誤「typeerror:nonetype object not callable」
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()
作品,,謝謝! – dioretsa
@dioretsa:如果它對你有幫助,請接受我的回答:) –