title: Python - Help me find a better way to extract and join all hashtags into a new dict value for each tweet
body: <p>I am attempting to parse some Twitter data that is from the Twitter Streaming API and is stored in a nested JSON format.  I would like to create a new dict key:value pair called <code>'HASHTAGS'</code> that holds all of the hashtags in an array.  I do not want to use a regex to extract the values from the tweet text, instead, I want to do this based on the nested JSON metadata field <code>['entities']['hashtags']['text']</code>.</p>
  
  <p>The difficulty comes into the fact that not all tweets have a hashtag, and therefore might not have this field.  On top of this, some tweets might have multiple hashtags, and I want to extract all of them, not just the first one. </p>
  
  <p>I think I've found a way to do this, but it seems very clunky, and not ideal.  Also, this only creates the dict <code>'HASHTAGS'</code> for tweets that have a hashtag.  I want <code>'HASHTAGS'</code> to be created for every record, but only be populated for records that have a hashtag, including multiple hashtags. </p>
  
  <p><strong>DATA</strong></p>
  
  <pre><code>{"created_at":"Fri Nov 21 01:17:34 +0000 2014","id":535602890459455488,"id_str":"535602890459455488","text":"RT @rightinillinois: Obama says get right with the law as he's breaking the oath to America's face. #tcot","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":71807953,"id_str":"71807953","name":"USA Hipster","screen_name":"USAHipster","location":"Made in USA","url":null,"description":"HUGE FoxNews FAN!!! USA watchdog, conservative, christian, tea party supporter, whitewater rafter and snow skiier. Whoosh!","protected":false,"verified":false,"followers_count":9066,"friends_count":7566,"listed_count":256,"favourites_count":178,"statuses_count":70404,"created_at":"Sat Sep 05 14:07:14 +0000 2009","utc_offset":-21600,"time_zone":"Central Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"9AE4E8","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/34629530\/WavingFlag.jpg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/34629530\/WavingFlag.jpg","profile_background_tile":true,"profile_link_color":"0084B4","profile_sidebar_border_color":"BDDCAD","profile_sidebar_fill_color":"D6D2D3","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1252787025\/flag_06_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1252787025\/flag_06_normal.jpg","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Fri Nov 21 01:12:36 +0000 2014","id":535601639378653184,"id_str":"535601639378653184","text":"Obama says get right with the law as he's breaking the oath to America's face. #tcot","source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":72580029,"id_str":"72580029","name":"Jerry","screen_name":"rightinillinois","location":"","url":null,"description":null,"protected":false,"verified":false,"followers_count":2696,"friends_count":1815,"listed_count":110,"favourites_count":14,"statuses_count":12527,"created_at":"Tue Sep 08 15:29:16 +0000 2009","utc_offset":-21600,"time_zone":"Central Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"1A1B1F","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme9\/bg.gif","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme9\/bg.gif","profile_background_tile":false,"profile_link_color":"2FC2EF","profile_sidebar_border_color":"181A1E","profile_sidebar_fill_color":"252429","profile_text_color":"666666","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/486610981003337728\/vDH2QZ6y_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/486610981003337728\/vDH2QZ6y_normal.jpeg","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":1,"favorite_count":1,"entities":{"hashtags":[{"text":"tcot","indices":[79,84]}],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en"},"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"tcot","indices":[100,105]}],"trends":[],"urls":[],"user_mentions":[{"screen_name":"rightinillinois","name":"Jerry","id":72580029,"id_str":"72580029","indices":[3,19]}],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416532654763"}
  {"created_at":"Fri Nov 21 01:19:45 +0000 2014","id":535603439942635520,"id_str":"535603439942635520","text":"RT @fishinsam: #cspanchat dont we have people here that are citizens that need to get right with the law?","source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":67169191,"id_str":"67169191","name":"Kitty Smalls","screen_name":"FluffySays","location":"USA","url":"http:\/\/politicsthetruthisoutthere.blogspot.com\/","description":"Progressive ALL THE WAY! Family person. Love country. Despise ignorance! Education promoter. Baffled over people following leaders without examining facts.","protected":false,"verified":false,"followers_count":1257,"friends_count":1367,"listed_count":25,"favourites_count":454,"statuses_count":28433,"created_at":"Thu Aug 20 00:08:53 +0000 2009","utc_offset":-28800,"time_zone":"Pacific Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"FCB6EC","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_link_color":"088253","profile_sidebar_border_color":"F257E8","profile_sidebar_fill_color":"F587C5","profile_text_color":"634047","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/371440359\/Twitter_Name_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/371440359\/Twitter_Name_normal.jpg","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Fri Nov 21 01:13:32 +0000 2014","id":535601875899273216,"id_str":"535601875899273216","text":"#cspanchat dont we have people here that are citizens that need to get right with the law?","source":"\u003ca href=\"http:\/\/janetter.net\/\" rel=\"nofollow\"\u003eJanetter\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":55830051,"id_str":"55830051","name":"fishinsam","screen_name":"fishinsam","location":"","url":null,"description":null,"protected":false,"verified":false,"followers_count":220,"friends_count":24,"listed_count":16,"favourites_count":6,"statuses_count":59611,"created_at":"Sat Jul 11 13:26:50 +0000 2009","utc_offset":-21600,"time_zone":"Central Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/2223044616\/18_fish_normal.JPG","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/2223044616\/18_fish_normal.JPG","default_profile":true,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":1,"favorite_count":1,"entities":{"hashtags":[{"text":"cspanchat","indices":[0,10]}],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en"},"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"cspanchat","indices":[15,25]}],"trends":[],"urls":[],"user_mentions":[{"screen_name":"fishinsam","name":"fishinsam","id":55830051,"id_str":"55830051","indices":[3,13]}],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416532785770"}
  {"created_at":"Fri Nov 21 01:26:49 +0000 2014","id":535605218314960896,"id_str":"535605218314960896","text":"mariabotta: I support POTUS plan of action for #ImmigrationReform not deporting families, and allowing get right with the law. Don't Forg...","source":"\u003ca href=\"http:\/\/ifttt.com\" rel=\"nofollow\"\u003eIFTTT\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2895978157,"id_str":"2895978157","name":"A.T.O.M","screen_name":"atomsoffice","location":"","url":null,"description":null,"protected":false,"verified":false,"followers_count":70,"friends_count":0,"listed_count":15,"favourites_count":0,"statuses_count":24639,"created_at":"Mon Nov 10 20:44:30 +0000 2014","utc_offset":-21600,"time_zone":"Central Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/531910902312751104\/XA8nxcOD_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/531910902312751104\/XA8nxcOD_normal.jpeg","default_profile":true,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"ImmigrationReform","indices":[47,65]}],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416533209767"}
  {"created_at":"Fri Nov 21 01:48:24 +0000 2014","id":535610646772342784,"id_str":"535610646772342784","text":"RT @JeffVaughn: Excerpt from @BarackObama #Immigration address: \"If you meet the criteria, you can come out of the shadows and get right wi\u2026","source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2540471527,"id_str":"2540471527","name":"Jeffrey Lindahl","screen_name":"JeffreyLindahl","location":"Dearborn Heights, MI","url":null,"description":"Just me #UniteBlue","protected":false,"verified":false,"followers_count":25,"friends_count":169,"listed_count":5,"favourites_count":2655,"statuses_count":2883,"created_at":"Sun Jun 01 23:57:20 +0000 2014","utc_offset":null,"time_zone":null,"geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"022330","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme15\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme15\/bg.png","profile_background_tile":false,"profile_link_color":"0084B4","profile_sidebar_border_color":"A8C7F7","profile_sidebar_fill_color":"C0DFEC","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/473253422045478912\/1nsQ3RnG_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/473253422045478912\/1nsQ3RnG_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2540471527\/1406322531","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Fri Nov 21 00:57:38 +0000 2014","id":535597874252632064,"id_str":"535597874252632064","text":"Excerpt from @BarackObama #Immigration address: \"If you meet the criteria, you can come out of the shadows and get right with the law.\"","source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":25276610,"id_str":"25276610","name":"Jeff Vaughn","screen_name":"JeffVaughn","location":"Motor City ","url":"http:\/\/facebook.com\/jeffvaughnjournalist","description":"WXYZ-TV 5pm Anchor \/ Reporter. Colorado kid and Kansas (State) boy. Lucky husband, devoted dad, cyclist and three time Emmy award winner.","protected":false,"verified":false,"followers_count":3429,"friends_count":1279,"listed_count":148,"favourites_count":1416,"statuses_count":12911,"created_at":"Thu Mar 19 12:13:20 +0000 2009","utc_offset":-21600,"time_zone":"Central Time (US &amp; Canada)","geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"334582","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/239808685\/JeffBkgd2.jpg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/239808685\/JeffBkgd2.jpg","profile_background_tile":false,"profile_link_color":"1B213B","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"5781BD","profile_text_color":"000000","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/2463854806\/9dtz8rpwbpajpax4npds_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/2463854806\/9dtz8rpwbpajpax4npds_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/25276610\/1357443681","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":2,"favorite_count":1,"entities":{"hashtags":[{"text":"Immigration","indices":[26,38]}],"trends":[],"urls":[],"user_mentions":[{"screen_name":"BarackObama","name":"Barack Obama","id":813286,"id_str":"813286","indices":[13,25]}],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en"},"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"Immigration","indices":[42,54]}],"trends":[],"urls":[],"user_mentions":[{"screen_name":"JeffVaughn","name":"Jeff Vaughn","id":25276610,"id_str":"25276610","indices":[3,14]},{"screen_name":"BarackObama","name":"Barack Obama","id":813286,"id_str":"813286","indices":[29,41]}],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416534504012"}
  {"created_at":"Sat Nov 22 13:11:02 +0000 2014","id":536144826434342912,"id_str":"536144826434342912","text":"The people of Israel were trying to get right with God by keeping the law instead of by trusting in him. Romans 9:32","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":498244376,"id_str":"498244376","name":"The Bible for Life","screen_name":"TheBibleForLife","location":"Chesapeake, Virginia USA","url":"http:\/\/www.biblegateway.com\/","description":"Scripture, ReTweets and More! Dedicated to spreading God's word to all the earth. #FollowJesus","protected":false,"verified":false,"followers_count":2541,"friends_count":1972,"listed_count":54,"favourites_count":3476,"statuses_count":6011,"created_at":"Mon Feb 20 20:57:31 +0000 2012","utc_offset":-18000,"time_zone":"Eastern Time (US &amp; Canada)","geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"131516","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/444222787947732992\/oXTqO4Fx.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/444222787947732992\/oXTqO4Fx.jpeg","profile_background_tile":false,"profile_link_color":"1754BD","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"EFEFEF","profile_text_color":"333333","profile_use_background_image":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/449241503643086848\/tLsUwfd5_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/449241503643086848\/tLsUwfd5_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/498244376\/1367010961","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416661862368"}
  {"created_at":"Sat Nov 22 13:11:48 +0000 2014","id":536145021654011904,"id_str":"536145021654011904","text":"RT @TheBibleForLife: The people of Israel were trying to get right with God by keeping the law instead of by trusting in him. Romans 9:32","source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":36842985,"id_str":"36842985","name":"December4th\u2764","screen_name":"XOXOsunasia","location":"Norfolk, VA","url":"https:\/\/m.facebook.com\/profile.php?id=1374928106095929","description":"Hi ! i came up with a campaign called How Would You Feel ? (HWYF) Its a Anti-Bullying Campaign.","protected":false,"verified":false,"followers_count":4534,"friends_count":4489,"listed_count":30,"favourites_count":22287,"statuses_count":172349,"created_at":"Fri May 01 01:29:09 +0000 2009","utc_offset":-18000,"time_zone":"Quito","geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"EBEBEB","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/806596237\/74fd71bd32d4f90c0c444fefa437dc0f.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/806596237\/74fd71bd32d4f90c0c444fefa437dc0f.jpeg","profile_background_tile":true,"profile_link_color":"4A913C","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"F3F3F3","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/534818464075354112\/S6vI47M6_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/534818464075354112\/S6vI47M6_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/36842985\/1411541625","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Sat Nov 22 13:11:02 +0000 2014","id":536144826434342912,"id_str":"536144826434342912","text":"The people of Israel were trying to get right with God by keeping the law instead of by trusting in him. Romans 9:32","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":498244376,"id_str":"498244376","name":"The Bible for Life","screen_name":"TheBibleForLife","location":"Chesapeake, Virginia USA","url":"http:\/\/www.biblegateway.com\/","description":"Scripture, ReTweets and More! Dedicated to spreading God's word to all the earth. #FollowJesus","protected":false,"verified":false,"followers_count":2541,"friends_count":1972,"listed_count":54,"favourites_count":3476,"statuses_count":6011,"created_at":"Mon Feb 20 20:57:31 +0000 2012","utc_offset":-18000,"time_zone":"Eastern Time (US &amp; Canada)","geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"131516","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/444222787947732992\/oXTqO4Fx.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/444222787947732992\/oXTqO4Fx.jpeg","profile_background_tile":false,"profile_link_color":"1754BD","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"EFEFEF","profile_text_color":"333333","profile_use_background_image":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/449241503643086848\/tLsUwfd5_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/449241503643086848\/tLsUwfd5_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/498244376\/1367010961","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":1,"favorite_count":0,"entities":{"hashtags":[],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en"},"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"trends":[],"urls":[],"user_mentions":[{"screen_name":"TheBibleForLife","name":"The Bible for Life","id":498244376,"id_str":"498244376","indices":[3,19]}],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416661908912"}
  {"created_at":"Sat Nov 22 13:37:11 +0000 2014","id":536151406764621824,"id_str":"536151406764621824","text":"Obama 2 Boehner on Fri.defending his exec.action:\"The Rep.leader has stood between \u201cmillions of people&amp;amp;the chance 2 get right with the law.\u201d","source":"\u003ca href=\"http:\/\/twitter.com\/#!\/download\/ipad\" rel=\"nofollow\"\u003eTwitter for iPad\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":329231890,"id_str":"329231890","name":"Margaret Morris","screen_name":"margaretvmorris","location":"Jacksonville, FL","url":null,"description":"Now, just a mom, grandmother and great-grandmother...peacemaker, pol.independent, beginning to love the sound of Liberal Democrat. I've found my voice!","protected":false,"verified":false,"followers_count":1836,"friends_count":1913,"listed_count":53,"favourites_count":8795,"statuses_count":43699,"created_at":"Mon Jul 04 18:52:36 +0000 2011","utc_offset":null,"time_zone":null,"geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/516238772196106240\/HQ_XqjiL_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/516238772196106240\/HQ_XqjiL_normal.jpeg","default_profile":true,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"trends":[],"urls":[],"user_mentions":[],"symbols":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"medium","lang":"en","timestamp_ms":"1416663431241"}
  </code></pre>
  
  <p><strong>CURRENT PROCESS</strong></p>
  
  <pre><code># load data into a list of dicts
  tweets = []
  for line in open('tweets.json'):
      try:
          tweets.append(json.loads(line))
      except:
          pass
  
  # check if line contains a hashtag, and if so, extact all hashtags into a list
  hashtags = []
  if len(line['entities']['hashtags']) &gt; 0:
      hashtags.extend(line['entities']['hashtags'])
      line['HASHTAGS'] = [tag['text'] for tag in hashtags]
  </code></pre>