Home > other >  A list of the index, python how to convert into another list of corresponding element?
A list of the index, python how to convert into another list of corresponding element?

Time:02-06


As shown in figure, thank you!

CodePudding user response:

First index from zero beginning, if you want to press you mean starting from 1, is to manually add 1
> A=(' a ', 'b', 'c')
> B=(' b ', 'a', 'c')
> C=a tuple (b.i ndex (x) + 1 for x in a)
> C
(2, 1, 3)
  • Related