【python】队列
2016-07-26 18:59
381 查看
来源:http://www.cnblogs.com/yupeng/p/3413852.html
关于队列
>>> from collections import deque >>> queue = deque(["Eric", "John", "Michael"]) >>> queue.append("Terry") # Terry arrives >>> queue.append("Graham") # Graham arrives >>> queue.popleft() # The first to arrive now leaves 'Eric' >>> queue.popleft() # The second to arrive now leaves 'John' >>> queue # Remaining queue in order of arrival deque(['Michael', 'Terry', 'Graham'])
相关文章推荐
- python 字典排序
- python find()用法
- Python 导入机制 - import hook
- Python学习
- python几大排序算法
- python学习笔记——异常
- Python之文件操作及常用函数
- python操作mysql数据库
- Python自动化之语法基础
- python常用包安装错误
- Python写日志
- python类定义与c#的一些区别
- Python发邮件
- 以写代学:python 列表元素操作&&函数&&模拟入栈出栈脚本
- easy_install 和 pip 的安装及使用
- python 安装yaml
- with statement
- python数据分析笔记(1):搭建python的数据分析环境(Mac系统下)
- 通过代码学习python之@property,@staticmethod,@classmethod
- 习题26 恭喜你,现在可以考试了!