content = {'name':['张三','李四','法外狂徒',{"邪":"王五","恶":'孙六'}],'day':[('周一','周二'),('周三','周四'),('周五','周六')],'string':{'list1':['3','4','2','6','1'],}}#1、输出罪之恶孙六a = content['name'][3]['恶']print('罪之恶'+a)#2、输出周四、周六a = content['day'][1][1]b = content['day'][2][1]print(a,b)#3、输出list1内所有字符串元素拼接结果c = content['string']['list1']d = "".join(c)print(d)
如果觉得《python字典操作 对字典元素输出练习(字典嵌套列表 嵌套字典)》对你有帮助,请点赞、收藏,并留下你的观点哦!