python 多线程入门


多线程是一门复杂的技术,这个表现在各个语言当中。下面我们简单讲解一下python的多线程。
 
1 多线程定义
 
class myclass(threading.Thread):
    '''python thread demo 1,
feel happy today!'''
    def __init__(self):
        threading.Thread().__init__()
    def run(self):
        list = range(10)
        for item in list:
            print '%d'%item+'dddd'
 
2 多线程的调用
 
obj = myclass()
 
obj.run()
 
3 多线程锁资源
 
 

相关内容

    暂无相关文章

评论关闭