Looping Techniques

Looping Techniques

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

  Looping Techniques

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.

  Looping Techniques

  Equivalent to:

  Looping Techniques

3、zip

  Looping Techniques

4、sorted

  Looping Techniques

5、reversed

  Looping Techniques

  

上一篇:Springmvc常用注解


下一篇:shareplex三点同步配置