一、遍历字典
定义一个学生字典
stu = {"name": "zutuanxue_com", "age": 18, "sex": "男", "height": 173.5, "weight":80,..."id": 1}
for key in stu
遍历字典的key
for key in stu:
print(key, stu[key])
for value in stu.values()
遍历字典元素
in stu.values():
print(value)
for key, value in stu.items()
遍历字典的...,可以得到类似下标的顺序值,但是注意,字典是无序的
二、遍历set集合
定义一个集合
s = set([1,2,3,4,5])
for key in s
for key in s:
print(