>>> next(( x for x in range(3)))
0
>>> next(( x for x in range(3)))
0
>>> next(( x for x in range(3)))
0
第二种方法:
>>> L = ( x for x in range(3))
>>> next(L)
0
>>> next(L)
1
>>> next(L)
2
>>> next(L)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
志存高远seismic
第一种方法:
第二种方法:
两种调用next()函数的方法得到的结果截然不同!!