37,719
社区成员
发帖
与我相关
我的任务
分享
for i in xrange(threads_num):
t = iamthreading()
threads.append(t)
for i in xrange(threads_num):
threads[i].start()
for i in xrange(threads_num):
threads[i].join()
while 1:
iamthreading().start()
threads = [iamthreadingr() for i in xrange( threads_num )]
if [(j.setDaemon( True ), j.start()) for j in threads] == [i.join() for i in threads]:
print 'all wars are civil wars,because all men are brothers.'
>>> from Queue import Queue
>>> q = Queue(0)
>>> q.put(9)
>>> q.put(8)
>>> q.put(7)
>>> q.put(6)
>>> if [1, 2, 3] == [q.get() for i in xrange(3)]:
... print "hei hei"
...
>>> q.get()
6
>>>
>>> from Queue import Queue
>>> q = Queue(0)
>>> q.put(9)
>>> q.put(8)
>>> q.put(7)
>>> q.put(6)
>>> if [1,2] == [q.get() for i in xrange(3)]:
... print "hei hei"
...
>>> q.get()
6
>>>
for t in theads:
t.join()