大家好,又见面了,我是你们的朋友全栈君。...1.for … in 循环
循环,遍历,迭代 都是指把容器中的数据一个一个获取出来
lst = [1,2,3,4,5]
i = 0
while i<len(lst):
print(lst[i])
i...+=1
# 无法用while 它的索引下标获取集合其中的值;
setvar = {
"a","b","c"}
for .. in .....可迭代对象( 通常用到的是: 容器类型数据 , range对象 , 迭代器 )
2.遍历集合
container = {
"taibai","wusir","wuchao","bijiao"}...for 一般用于数据的遍历
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/170074.html原文链接:https://javaforall.cn