alex_bn_lee

导航

【380】python 获取列表排序后的索引列表

参考:Equivalent of Numpy.argsort() in basic python? - Stack Overflow  

通过 enumerate 实现

[i for i,v in sorted(enumerate(['Vincent', 'Alex', 'Bill', 'Matthew']), key=lambda x:x[1])]

output:
[1, 2, 3, 0]

  

posted on 2019-03-19 06:37  McDelfino  阅读(4476)  评论(0编辑  收藏  举报