由于某些原因,我得到的模块对象在此代码上不可调用错误。我真的不明白为什么?什么事情发生,我该如何解决? :(
import time
start_time = time.time()
name = raw_input('What is your name')
end_time = time.time()
total_time=end_time-start_time
print total_time
和追溯:
Traceback (most recent call last):
File "time.py", line 1, in <module>
import time File "/Users/Me/randomcode/time.py", line 2, in <module>
start_time = time.time()
TypeError: 'module' object is not callable
答案 0 :(得分:17)
不要调用您自己的脚本文件time.py
...它正在导入自己!