Python iterator generator (3), python Generator
Extended list parsing syntax
Continue writing today and yesterday.
List parsing can become more complex-for example, it can contain nested loops or be written as a series of for clauses. (Here is a brief introduction to this syntax)
For example, to construct an x + y join table, connect each x in a string with every y in another string. It effectively collects the character arrangement of two strings:
List parsing expressions can often become more compact. Generally, they indent and simplify the iteration type. for more work, a simple for statement may be easier to understand, and it will be easier to modify in the future.
Other iteration Environments
List parsing, in member testing, built-in map functions, and built-in functions such as sorted and zip calls also use the iteration protocol. When applied to a temporary file, the iterators that use the file object will automatically scan: