1、将无序的字典与列表结合变得有序
info = {"name": "mcw", "age": "18","hobby":"study"} li=[i for i in info] print(li,li[0],li[-1],info[li[1]]) --------------结果: ['name', 'age', 'hobby'] name hobby 18
2、生成列表中每个元素都是相同键的字典
1、将无序的字典与列表结合变得有序
info = {"name": "mcw", "age": "18","hobby":"study"} li=[i for i in info] print(li,li[0],li[-1],info[li[1]]) --------------结果: ['name', 'age', 'hobby'] name hobby 18
2、生成列表中每个元素都是相同键的字典
转载于:https://www.cnblogs.com/machangwei-8/p/10707313.html