视频版教程 Python3零基础7天入门实战视频教程
我们假如需要获取列表的所有元素,我们可以通过前面学过的while或者for循环遍历来获取;
for循环案例:
list1 = ["java", "python", "c"]
for ele in list1:
print(ele)
while循环案例:
i = 0
while i < len(list1):
ele = list1[i]
print(ele)
i += 1
视频版教程 Python3零基础7天入门实战视频教程
我们假如需要获取列表的所有元素,我们可以通过前面学过的while或者for循环遍历来获取;
for循环案例:
list1 = ["java", "python", "c"]
for ele in list1:
print(ele)
while循环案例:
i = 0
while i < len(list1):
ele = list1[i]
print(ele)
i += 1