我是python编程新手,有个问题。我整天都在寻找解决it问题的方法,但到目前为止,我所发现的一切对我都没有帮助。我正在用Python编写一个时间延迟程序,但是一旦它碰到延迟的输入,就会给我一个错误。我试过在同一个程序中运行它,但我希望这两个程序是分开的。在
这是中的延迟函数延迟.py在
def delayA(ina):
ina=float(ina)
print("okay!")
time.sleep(ina)
print("done!")
这是我的主旋律
^{pr2}$这是我一整天都收到的错误信息
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Python/inputcall.py", line 1, in <module>
import delay.py
ImportError: No module named 'delay.py'; 'delay' is not a package
提前感谢您的帮助!在
你几乎就在那里,除了一些小错误:
延迟.py:
主.py:
^{pr2}$我发现你仅有的三个错误是:
delayA
函数缺少缩进。在from delay import delayA
不是:import delay.py
delayA
函数。i、 e:from foo import bar
相关问题 更多 >
编程相关推荐