这是我的问题。我知道了
{'Ciaran Johnson': {'PB': 58.2,
'Gender': 'M',
'Age': 6,
'Event': 'IM',
'Name': 'Ciaran Johnson'},
'Joan Pine': {'PB': 44.0,
'Gender': 'F',
'Age': 6,
'Event': 'FS',
'Name': 'Joan Pine'},
'Eric Idle': {'PB': 57.2,
'Gender': 'M',
'Age': 6,
'Event': 'IM',
'Name': 'Eric Idle'},
'Kirsty Laing': {'PB': 58.2,
'Gender': 'F',
'Age': 6,
'Event': 'IM',
'Name': 'Kirsty Laing'}}
我必须先按性别排序,然后是事件和最后一次(PB-最快的第一次)
不能对} :
dict
排序,因为标准字典是无序的。但是,您可以使用^{试试这个
你不能用Python对字典进行排序,它们天生就是无序的。在
但是,您可以sort the keys(),这将创建一个列表,然后使用该列表以伪有序的方式访问元素。在
相关问题 更多 >
编程相关推荐