码迷,mamicode.com
首页 > 其他好文 > 详细

Looping Techniques

时间:2016-08-23 18:48:12      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

Looping Techniques

1、When looping through dictionaries, the key and corresponding value can be retrieved at the same time using the items() method.

  技术分享

2、enumerate(iterable, start=0)

  Return an enumerate object. iterable must be a sequence, an iterator, or some other object which supports iteration. The __next__() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over iterable.

  技术分享

  Equivalent to:

  技术分享

3、zip

  技术分享

4、sorted

  技术分享

5、reversed

  技术分享

  

 

Looping Techniques

标签:

原文地址:http://www.cnblogs.com/tekkaman/p/5800460.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!