for m in range(1,10):
for n in range(1,m+1):
print("{0}*{1}={2}".format(m,n,(m*n)),end="\t")
print()
执行结果:
1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25
.....
r1 = dict(name="高小一",age=18,salary=30000,city="北京")
r2 = dict(name="高小二",age=19,salary=20000,city="上海")
r3 = dict(name="高小三",age=20,salary=10000,city="深圳")
tb = [r1,r2,r3]
for x in tb:
if x.get("salary")>15000:
print(x)