sorting multiple lists based on a single list in python

前端 未结 3 1564
忘掉有多难
忘掉有多难 2021-01-02 00:58

I\'m printing a few lists but the values are not sorted.

for f, h, u, ue, b, be, p, pe, m, me in zip(filename, human_rating, rating_unigram, percentage_error         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 01:47

    zip returns a list of tuples which you can sort by their first value. So:

    for ... in sorted(zip( ... )):
        print " ... "
    

提交回复
热议问题