码迷,mamicode.com
首页 >  
搜索关键字:enumerate    ( 668个结果
python-2_文件读取_模块调用_循环
enumerate()枚举函数例子:forindex,keyinennumerate(menu.keys()):printindex,keyforiinenumerate(range(1,10)):printi输出结果:(0,1)(1,2).......(9,10)os.popen()用来存结果os.popen("dir").read()执行的输出os.system()执行命令commands.getoutput("dir")执行命令input输..
分类:编程语言   时间:2016-11-29 00:09:36    阅读次数:225
Python核心编程-细节
直接从六张开始看看书里有什么。 cmp() len() max() and min() sorted() and reversed() enumerate() and zip() sum() list() and tuple() dir()方法来得到它所有的方法和属性 extend() and ap ...
分类:编程语言   时间:2016-11-28 22:42:06    阅读次数:215
enumerate用法
Return an enumerate object. sequence must be a sequence, an iterator, or some other object which sup- ports iteration. The next() method of the iterat ...
分类:编程语言   时间:2016-11-28 08:30:11    阅读次数:242
迭代与列表生成式、生成器
一、迭代 python中如何判断一个对象是可迭代对象呢?方法是通过collections模块的Iterable类型判断: Python内置的enumerate函数可以把一个list变成索引-元素对,这样就可以在for循环中同时迭代索引和元素本身: 二、列表生成式 要生成list [1, 2, 3, ...
分类:其他好文   时间:2016-11-24 18:26:08    阅读次数:268
python中的enumerate函数
enumerate 函数用于遍历序列中的元素以及它们的下标: >>> for i,j in enumerate(('a','b','c')): print i,j 0 a1 b2 c>>> for i,j in enumerate([1,2,3]): print i,j 0 11 22 3>>> f ...
分类:编程语言   时间:2016-11-22 19:52:03    阅读次数:198
购物车小程序练习
1 product = [ 2 ('羽绒服',200), 3 ('毛衣',80), 4 ('衬衫',50), 5 ('牛仔裤',120), 6 ('t恤',55), 7 ('苹果笔记本',8000)] 8 shop_car = [] 9 print ("欢迎来到购物商城!".center(50,'- ...
分类:其他好文   时间:2016-11-21 22:57:19    阅读次数:274
标题我也不知道写啥
分割线 ...
分类:其他好文   时间:2016-11-21 19:37:47    阅读次数:339
数据分析:ufunc
universal function 可以对数组里的每一个元素进行操作,底层是C语言实现的,在对数组运算时表现卓越 1.1 初步上手 1.2 小插曲 xrange xrange()得到的是一个迭代器,可以通过enumerate(x)进行迭代,而range()获得的是一个列表 1.3 运行速度 mat ...
分类:其他好文   时间:2016-11-20 06:49:40    阅读次数:259
Python内建方法
内建方法 常用内建方法all divmod input open staticmethod abs enumerate int ord str any eval isinstance pow sum ...
分类:编程语言   时间:2016-11-15 11:22:41    阅读次数:216
Python学习总结
文中有些地方是用2.7开发的,如果您安装的是3.x,有几点需要注意: print "xxx" 要换成 print("xxx") __metaclass__ = type 删除掉。 类型和表达式部分 你好,世界! 乘方 变量 注:这里的var = xxxx不叫变量赋值,而叫变量绑定,python维护了 ...
分类:编程语言   时间:2016-11-13 19:17:15    阅读次数:261
668条   上一页 1 ... 53 54 55 56 57 ... 67 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!