6.6 列表的循环遍历
一、列表循环遍历
while循环遍历
my_list = [1, 2, 3, 4, 5, 6, 7] index = 0 while index < len(my_list): print(my_list[index]) index += 1for循环遍历
my_list = [1, 2, 3, 4, 5, 6, 7] for i in my_list: print(i)
Last updated
Was this helpful?
while循环遍历
my_list = [1, 2, 3, 4, 5, 6, 7]
index = 0
while index < len(my_list):
print(my_list[index])
index += 1for循环遍历
my_list = [1, 2, 3, 4, 5, 6, 7]
for i in my_list:
print(i)Last updated
Was this helpful?
Was this helpful?