for循环使用
ds = {'url':'https://www.baidu.com',
'date':{'username':'muzhi','pw':'123456'}}
for i in ds:
# print(i) # 打印结果:url date
# print(ds[i]) # 打印结果:https://www.baidu.com {'username': 'muzi', 'pw': '123456'}
if i == 'date': # 判断如果是date,则遍历date值
for j in ds['date'].values():
print(j)
else:
print(ds[i])