for循环处理列表的显示
python中新增列表并显示:
fav_movies = ["The Holy Grail","The Life of Brian"]
print(fav_movies[0])
print(fav_movies[1])
但是如果有很长的列表需要显示,这时候可以用for迭代进行循环显示:
fav_movies = ["The Holy Grail","The Life of Brian"]
for each_flick in fav_movies:
print(each_flick)
for循环就是为了处理列表和Python中的其他迭代结构。