[Solved] Python – IndexError: list index out of range


This is not a valid python code, u are missing braces. Here :

data = {
u'entities': {
    u'symbols': [], 
    u'user_mentions': [],
    u'hashtags': [{u'indices': [3, 13], u'text': u'firstpost'},
                  {u'indices': [22, 35], u'text': u'snowinginnyc'}],
    u'urls': [{u'url': u'https://t.co/0sClwIMXKW', 
               u'indices': [36, 59],
               u'expanded_url': u'https://vine.co/v/hQPlQ9l5XDD',
               u'display_url': u'vine.co/v/hQPlQ9l5XDD'}
             ]
}
}

and print data['entities']['urls'][0]['expanded_url']

prints vine.co/v/hQPlQ9l5XDD

solved Python – IndexError: list index out of range