I want to extract all the words that are before "indices" (i.e ForeverTrophyless, NoPainNoGame, Prize) and put em all inside a list. How Can I do that?
foo = '[{"text":"ForeverTrophyless","indices":[0,18]},{"text":"ForeverTrophyless","indices":[19,37]},{"text":"Prize","indices":[38,56]},{"text":"ForeverTrophyless","indices":[57,75]},{"text":"NoPainNoGame","indices":[76,94]},{"text":"ForeverTrophyless","indices":[95,113]},{"text":"ForeverTrophyless","indices":[114,132]}]'
Python2.7
Pycharm Ubuntu 14.04
[x['text'] for x in foo]. Also, there's no such thing like "before" in dictionaries, because they're unordered.