Python迭代器(Iterator)

Python迭代器(Iterator)_迭代器

Python迭代器(Iterator)_Python_02

Python迭代器(Iterator)_python_03

 

listmy = [1, 2, 3, 4, 5]

print(listmy)

listmy2 = []
for i in listmy:
    listmy2.append(i**2)

print(listmy2)

Python迭代器(Iterator)_python_04