|
- employees ={
- '老张':18000,
- '老王':28000,
- '小李':10000,
- '小丽':8000
- }
- top = []
- for name,salary in employees.items():
- if salary > 10000:
- top.append([name,salary])
- print(top)
- for i in top:
- print(i)
- for i,j in employees.items():
- # print(i,j)
- if j >10000:
- print(i)
复制代码 运行结果:
- [['老张', 18000], ['老王', 28000]]
- ['老张', 18000]
- ['老王', 28000]
- 老张
- 老王
复制代码
|
|