首页 > 其他 > 详细

Looping Techniques

时间:2016-08-23 18:45:37      阅读:180      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!