from collections import defaultdict
d=defaultdict(set)
s=[("001","A"),("001","C"),("002","B")]
for k,v in s:
d[k].add(v)

print(sorted(d.items()))

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-02-11
  • 2021-10-16
  • 2022-12-23
相关资源
相似解决方案