本文介绍了Python 3.3.3 time.sleep() 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误:
The error:"Traceback (most recent call last):
File "C:\Users\Jamie\Desktop\Python\ATM.py", line 8, in <module>
time.sleep(2)
NameError: name 'time' is not defined"
这是我的代码:
对于可能抛出这个问题的任何想法?
Any ideas towards what may be throwing this?
最好,
杰米
推荐答案
sleep
函数来自 python time
模块,所以你可以import
在你调用它的任何方法之前就放
the sleep
function comes from the python time
module so you to import
before you call any of it's methodsjust put
导入时间
在你使用任何时间的东西之前.将所有导入放在代码顶部是正常的.
before you use any time stuff. It's normal to just put all of your imports at the top of your code.
有关import
ing 的更多信息,请参见此处:
see here for more info on import
ing:
https://docs.python.org/3/reference/import.html
这篇关于Python 3.3.3 time.sleep() 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!