不返回的Python Put队列

2024-10-02 14:19:38 发布

您现在位置:Python中文网/ 问答频道 /正文

一直在尝试阅读文档和查看在线示例,但我的队列仍然没有返回任何结果。在

    from collections import defaultdict
    from Queue import Queue 

    -- in my init

    self.tickerPrices = dict()
    queue = Queue(maxsize=5)
    queue.put((0.00097073, 67689.70942763))
    self.tickerPrices['a'] = queue

    def appendToTickerDict(self, tickerid, askprice, volume):
      if(tickerid in self.tickerPrices):
            tickerQueue = self.tickerPrices[tickerid].put((askprice, volume))  --RETURNS NONE

tickerQueue返回None。在这一步之前,我测试了它,发现如果我在init中向这个队列添加了一些东西,那么在执行这段代码之前,它会显示为.get

任何提示都会很有帮助。在


Tags: infrom文档importself队列queueput