Python solves the problem of modulenotfounderror: no module named ‘queue’

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

We know that there are some incompatibilities between the two versions of python2 and python3. The introduction of queue in python3 will report this problem

In Python 3, it is introduced as follows:

1 import queue

In Python 2, we should introduce this method:

1 import Queue

For compatibility, it can be written as follows:

1 import sys
2 if sys.version > '3':
3     import queue as Queue
4 else:
5     import Queue

Similar Posts: