python怎么用reduce对列表的性别进行分组? 5
infos=({'name':'AlanTuring','age':105,'gender':'male'},{'name':'DennisRitchie','age':...
infos =({'name':'Alan Turing', 'age':105, 'gender':'male'},
{'name':'Dennis Ritchie', 'age':76, 'gender':'male'},
{'name':'Ada Lovelace', 'age':202, 'gender':'female'},
{'name':'Frances E. Allen', 'age':84, 'gender':'female'})
result = {'male': ['Alan Turing', 'Dennis Ritchie'],
'female': ['Ada Lovelace', 'Frances E. Allen']} 展开
{'name':'Dennis Ritchie', 'age':76, 'gender':'male'},
{'name':'Ada Lovelace', 'age':202, 'gender':'female'},
{'name':'Frances E. Allen', 'age':84, 'gender':'female'})
result = {'male': ['Alan Turing', 'Dennis Ritchie'],
'female': ['Ada Lovelace', 'Frances E. Allen']} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询