# 循环读取一个范围里面的数据
for iin range(10):
print(i)
for iin range(1,10):
print(i)
for iin range(1,10,2):
print(i)
# 循环读取字符串,tuple,list,set
list1 = [1,2,3]
tuple1 = (1,2,3)
string1 ='123'
set1 = {1,2,3}
for iin string1:
print(i)
dict1 = {'id':1,'name':'zhangsan','age':11}
# 读出所有的键值对
for k,vin dict1.items():
print(k,v)
网友评论