我正在尝试导入线程模块,但是,我似乎只是无缘无故地收到了错误。这是我的代码:
import threading
class TheThread ( threading.Thread ):
def run ( self ):
print 'Insert some thread stuff here.'
print 'I\'ll be executed...yeah....'
print 'There\'s not much to it.'
TheThread.Start()
以及错误:
Traceback (most recent call last):
File "threading.py", line 1, in <module>
import threading
File "C:\Users\Trent\Documents\Scripting\Python\Threading\threading.py", line
3, in <module>
class TheThread ( threading.Thread ):
AttributeError: 'module' object has no attribute 'Thread'
Press any key to continue . . .
Python统计:
Python 2.7.2(默认,2011 年 6 月 12 日,15:08:59)[MSC v.1500 32 位
(英特尔)] 在 win 32 上
我认为您所需要的只是重命名工作文件的名称,因为您的文件名与模块名称相同:
线程.py
或者你的工作目录中有错误的 threading.py 文件
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)