参考:
通过 enumerate 实现
[i for i,v in sorted(enumerate(['Vincent', 'Alex', 'Bill', 'Matthew']), key=lambda x:x[1])]output:[1, 2, 3, 0]
本文共 189 字,大约阅读时间需要 1 分钟。
参考:
通过 enumerate 实现
[i for i,v in sorted(enumerate(['Vincent', 'Alex', 'Bill', 'Matthew']), key=lambda x:x[1])]output:[1, 2, 3, 0]
转载于:https://www.cnblogs.com/alex-bn-lee/p/10556308.html