title: Python run script for every entry in a dictionary
body: <p>I'm trying to write a simple python programme that uses the tweepy API for twitter and wget to retrieve the image link from a twitter post ID (Example: twitter.com/ExampleUsername/<strong>12345678</strong>), then download the image from the link. The actual programme works fine, but there is a problem. While it runs FOR every ID in the dictionary (if there are 2 IDs, it runs 2 times), it doesn't use every ID, so the script ends up looking at the last ID on the dictionary, then downloading the image from that same id however many times there is an ID in the dictionary. Does anyone know how to make the script run again for every ID?</p>
  
  <p>tl;dr I want the programme to look at the first ID, grab its image link, download it, then do the same thing with the next ID until its done all of the IDs. </p>
  
  <pre><code>#!/usr/bin/env python
  # encoding: utf-8
  
  import tweepy #https://github.com/tweepy/tweepy
  import wget
  
  
  #Twitter API credentials
  consumer_key = "nice try :)"
  consumer_secret = "nice try :)"
  access_key = "nice try :)"
  access_secret = "my, this joke is getting really redundant"
  
  def get_all_tweets():
          #authorize twitter, initialize tweepy
          auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
          auth.set_access_token(access_key, access_secret)
          api = tweepy.API(auth)
  
          id_list = [1234567890, 0987654321]
          # Hey StackOverflow, these are example ID's. They won't work as they're not real twitter ID's, so if you're gonna run this yourself, you'll want to find some twitter IDs on your own
  
  # tweets = api.statuses_lookup(id_list)
          for i in id_list:
              tweets = []
              tweets.extend(api.statuses_lookup(id_=id_list, include_entities=True))
              for tweet in tweets:
                  spacefiller = (1+1)
                  # this is here so the loop runs, if it doesn't the app breaks 
              a = len(tweets)
              print(tweet.entities['media'][0]['media_url'])
              url = tweet.entities['media'][0]['media_url']
              wget.download(url)
  get_all_tweets()
  </code></pre>
  
  <p>Thanks,
  ~CS</p>