Using Queue in python

前端 未结 5 1690
无人及你
无人及你 2021-02-06 23:31

I\'m trying to run the following in Eclipse (using PyDev) and I keep getting error :

q = queue.Queue(maxsize=0) NameError: global name \'queue\' is not defined<

5条回答
  •  面向向阳花
    2021-02-07 00:17

    If you import from queue import * this is mean that all classes and functions importing in you code fully. So you must not write name of the module, just q = Queue(maxsize=100). But if you want use classes with name of module: q = queue.Queue(maxsize=100) you mast write another import string: import queue, this is mean that you import all module with all functions not only all functions that in first case.

提交回复
热议问题