1
这是我的代码:与FIFO队列我python3线程PROG没有工作
import threading
import queue
qq=queue.Queue(10)
def x11grab(n):
print('haha')
while True:
a='abcd'+str(n)
n+=1
qq.put(a)
print('put queue:',a)
def rtpsend():
while True:
s=qq.get()
head=s[:4]
body=s[4:]
print('head',head)
print('body',body)
t1=threading.Thread(target=x11grab,args=(1,))
t2=threading.Thread(target=rtpsend)
t1.start
t2.start
我想x11grab()函数把字符串 'ABCD1', 'ABCD2' ......到队列中,rtpsend()函数从队列中获取字符串并显示它。这是一个演示,但它不起作用。我认为你的建议可能会有帮助。:-)
OMG!我很...谢谢你,我应该从现在开始仔细编码。 – socket 2013-05-05 10:24:06