【Python】Learn Python the hard way, ex38 列表操作
来源:互联网 发布:仓储出库数据流程图 编辑:程序博客网 时间:2024/06/07 07:59
ten_things = "Apples Oranges Crows Telephone Light Sugar"print "Wait there's not 10 things in that list, let's fix that."stuff = ten_things.split(' ')more_stuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"]while len(stuff) != 10: next_one = more_stuff.pop() print "Adding: ", next_one stuff.append(next_one) print "There's %d items now." %len(stuff) print "There we go: ", stuffprint "Let's do some things with stuff."print stuff[1]print stuff[-1] #whoa! fancyprint stuff.pop()print " ".join(stuff) # what? cool!print '#'.join(stuff[3:5]) #supper stellar!'''Test Reslut:Wait there's not 10 things in that list, let's fix that.Adding: BoyThere's 7 items now.Adding: GirlThere's 8 items now.Adding: BananaThere's 9 items now.Adding: CornThere's 10 items now.There we go: ['Apples', 'Oranges', 'Crows', 'Telephone', 'Light', 'Sugar', 'Boy', 'Girl', 'Banana', 'Corn']Let's do some things with stuff.OrangesCornCornApples Oranges Crows Telephone Light Sugar Boy Girl BananaTelephone#Light'''
最喜欢Python两点,list,re
0 0
- 【Python】Learn Python the hard way, ex38 列表操作
- Learn Python The Hard Way学习(38) - 列表操作
- 列表的操作,习题38,learn python the hard way.
- Learn Python The Hard Way
- Learn Python The Hard Way
- 【Python】Learn Python the hard way, ex39 字典操作
- Learn Python The Hard Way学习(32) - 循环和列表
- Learn Python the Hard Way ex48
- 学《learn python the hard way》(3)
- learn python the hard way 的ex48
- Learn Python The Hard Way-Ecercise1~5
- Learn Python The Hard Way-Ecercise6~10
- Learn Python The Hard Way-Ecercise11~15
- Learn Python The Hard Way-Ecercise16~20
- Learn Python The Hard Way-Ecercise21~25
- Learn Python The Hard Way-Ecercise26~30
- Learn Python The Hard Way-Ecercise31~35
- Learn Python The Hard Way-Ecercise36~40
- neo4j安装与示例
- Lock与synchronized 的区别
- Windows服务编写原理及探讨【2】
- 指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
- Oracle index by table(Associative array) used in PostgreSQL
- 【Python】Learn Python the hard way, ex38 列表操作
- ArcGIS 常见拓扑错误的修改方法
- Makefile
- 我的开发环境配置
- RecycleView替代ListView的使用方法
- printf和scanf的原函数
- useful function & operator & custom operator for Row and Array Comparisons
- 粗糙集的概念和一些例子
- Windows服务编写原理及探讨【3】