Python迭代器(Iterator)

Python迭代器(Iterator)_python

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