Using Lists as Queues : Queue : Data Structure : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Data Structure   » [  Queue  ]  Screenshots 
 



Using Lists as Queues




# To add an item to the back of the queue, use append(). To retrieve an item 
# from the front of the queue, use pop() with as the index. For example:

queue = ["A""B""C"]
queue.append("D")          
queue.append("E")          
print queue.pop(0)

print queue.pop(0)

print queue

           
       
Related examples in the same category
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.