我正在处理一些简单的东西,因此我是python的新手,我想问一下有关将Queue.Queue()实例转换为列表的问题。
To extract all items from a queue, call get_nowait
repeatedly:
l = []
try:
while True:
l.append(q.get_nowait())
except Queue.Empty:
pass
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.