Python uses "()" to generate a generator

Insert image description here
As shown in the figure above, y is a generator, not a tuple, and can be accessed with next. The characteristic of the generator is that all elements can only be traversed once. If you want to generate an iterator, you can use "[]".

Guess you like

Origin blog.csdn.net/mch2869253130/article/details/121911815