last-occurrence

How to find the last occurrence of an item in a Python list

How to find the last occurrence of an item in a Python list Question: Say I have this list: li = [“a”, “b”, “a”, “c”, “x”, “d”, “a”, “6”] As far as help showed me, there is not a builtin function that returns the last occurrence of a string (like the reverse of index). So …

Total answers: 15