title: extract tweets from a text file (python)
body: <p>Sorry, I am just trying to store 'id_str' from each tweet to a new list called ids[]..
  but getting the following error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "extract_tweet.py", line 17, in 
        print tweet['id_str']
    KeyError: 'id_str'</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>import json
  import sys
  if __name__ == '__main__':
  tweets = []
  for line in open (sys.argv[1]):
  try:
    tweets.append(json.loads(line))
  except:
    pass
  ids = []
  for tweet in tweets:
  ids.append(tweet['id_str'])
  </code></pre>