Python 模拟简单的queue
来源:互联网 发布:减速机选型软件 编辑:程序博客网 时间:2024/05/22 20:28
#! /usr/bin/env pythonqueue = []def enQ(): queue.append(raw_input('Enter new string: ').strip())def deQ(): if len(queue) == 0: print 'Cannot pop from an empty queue!' else: print 'Removed [', `queue.pop(0)`, ']'def viewQ(): print queueCMDs = {'e': enQ, 'd': deQ, 'v': viewQ}def showmenu(): pr = """(E)nqueue(D)equeue(V)iew(Q)uitEnter choice: """ while True: while True: try: choice = raw_input(pr).strip()[0].lower() except (EOFError, KeyboardInterrupt, IndexError): choice = 'q' print '\nYou picked: [%s]' % choice if choice not in 'devq': print 'Invalid option, try again' else: break if choice == 'q': break CMDs[choice]()if __name__ == '__main__': showmenu()
0 0
- Python 模拟简单的queue
- 简单模拟实现队列Queue的模板类
- 简单Queue实现 python语言
- 简单的Queue
- python 的Queue
- Python的Queue
- Python Queue的使用
- Python模拟简单的Web服务器 &1
- Python 网络爬虫--简单的模拟登录
- gevent.queue和Python内置的Queue()
- python实现简单的redis 队列 SIMPLE PYTHON QUEUE WITH REDIS
- ZOJ2724 Windows Message Queue 裸queue的模拟
- STL 简单 queue 的实现
- 【C#】Queue的简单试用
- Unity3D -Queue的简单实用
- HDU 1387 Team Queue 队列的模拟
- 【数据结构】Stack和Queue的模拟实现
- python queue的一个实例
- 【flex4.6将移动开发进行到底】第一章第二节hello,flex4.6!
- SQL数据库索引
- 火狐浏览器小图标不显示
- 大数据将死
- Log4cplus入门
- Python 模拟简单的queue
- 【BFS|位运算+输出路径】POJ-2965 The Pilots Brothers' refrigerator
- raw_spin_lock与spin_lock
- static FFmpeg binaries for Mac OS X Intel 64bit
- 通过金矿模型介绍动态规划
- Xcode svn import项目 上传.a文件(静态库)
- 云计算和大数据应用技术免费讲座
- window2008下创建裸设备-为Oracle asm diskgroup准备
- 图像变换-使用Hough变换检测圆