My import of Python modules
import Queue
from threading import Thread
import time
But when I run code
File \"b1.py\", line
On Python 2, the module is named Queue
, on Python 3, it was renamed to follow PEP8 guidelines (all lowercase for module names), making it queue
. The class remains Queue
on all versions (following PEP8).
Typically, the way you'd write version portable imports would be to do:
try:
import queue
except ImportError:
import Queue as queue