1 #!/usr/bin/env python 2 obj = iter([11,22,33,44]) 3 #iter 创建一个可以被迭代的对象 4 print(obj) 5 r1 = next(obj) 6 print(r1) 7 8
结果:C:Python35python3.exe F:/Python/2day/c4.py <list_iterator object at 0x000002AF2B3DE048> 11 Process finished with exit code 0
1 #!/usr/bin/env python 2 obj = iter([11,22,33,44]) 3 #iter 创建一个可以被迭代的对象 4 print(obj) 5 r1 = next(obj) 6 print(r1) 7 8
结果:C:Python35python3.exe F:/Python/2day/c4.py <list_iterator object at 0x000002AF2B3DE048> 11 Process finished with exit code 0