Essay python (1)

 

Python is Iterable (iterator), generator (generator), yield

Iterator:

  We usually use the list, it is an iterator. Possible to read each element in the list by a for loop.

  All can be traversed in both iterators through .. for . Such as lists, strings, files

Builder:

  When the iterator declaration or a list of strings, when too much of the contents of their memory, will take up more memory. This time the role of generators began to unravel.

 

Guess you like

Origin www.cnblogs.com/jjb1997/p/11410167.html