list_high.sort(key=soort(list_high, search))
This calls soort(list_high, search)
once then passes its return value (an integer) as the key
argument for sort
, which makes no sense (integers are not callable).
You need to make sure to pass in a callable.
You should also consider using .find
instead of .index
, as .index
will raise a ValueError
if it can't find the searched string. .find
will return -1
.
list_high.sort(key=lambda word: word.find('br'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…