Using Python.Create a message queue.
时间: 2024-02-01 17:14:25 浏览: 165
Sure, here's an example of creating a message queue in Python using the built-in `queue` module:
```python
import queue
# Create a new queue
q = queue.Queue()
# Add items to the queue
q.put("Hello")
q.put("World")
# Get items from the queue
while not q.empty():
item = q.get()
print(item)
```
This will output:
```
Hello
World
```
Is there anything else you would like to know?
阅读全文