- 浏览: 97733 次
- 性别:
- 来自: 上海
-
最新评论
-
howgoo:
OpenSystemArchitect 中文乱码。
免费的数据库建模工具 -
tojaoomy:
如果需要输出时不换行,在最后加上逗号即可。比如print 'H ...
Python静态属性,静态方法 -
tojaoomy:
http://www.oracle.com/technetwo ...
丢失更新 -
tojaoomy:
teasp 写道tojaoomy 写道teasp 写道toja ...
synchronized (this) 柳暗花明又一村 -
teasp:
tojaoomy 写道teasp 写道tojaoomy 写道t ...
synchronized (this) 柳暗花明又一村
文章列表
range()函数经常和len()函数一起用于字符串索引。 在这里我们要显示每一个元素及其 索引值: >>> foo = 'abc' >>> for i in range(len(foo)): ... print foo[i], '(%d)' % i ... a (0) b (1) c (2) 不过, 这些循环有一个约束, 你要么循环索引, 要么循环元素。这导致了enumerate() 函数的推出(Python2.3 新增)。 它同时做到了这两点: >>> for i, ch in enumerate(foo): ... print ch, ...