Python字典刪除鍵
我從 Python 開(kāi)始,現(xiàn)在卡住了。我必須從 .txt 中的長(zhǎng)列表中獲取關(guān)鍵的“文本”,例如:{"delete":"status":"id":294512601600258048,"id_str":"294512601600258048","user_id":90681582,"user_id_str":"90681582"}, "timestamp_ms":"1410368494083"}}和{ "created_at": "Wed Sep 10 17:01:33 +0000 2014", "id": 509748524897292288, "id_str": "509748524897292288", "text": "@Brenamae_ I WHALE SLAP YOUR FIN AND TELL YOU ONE LAST TIME: GO AWHALE", "source": "\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e", "truncated": false, "in_reply_to_status_id": 509748106015948800, "in_reply_to_status_id_str": "509748106015948800", "in_reply_to_user_id": 242563886, "in_reply_to_user_id_str": "242563886", "in_reply_to_screen_name": "Brenamae_", "user": "id": 175160659, "id_str": "175160659", "name": "Butterfly", "screen_name": "VanessaLilyWan", "location": "Canada, Montreal", "url": "http:\/\/instagram.com\/vanessalilywan", "description": "British youtubers. 'Nuff said.", "protected": false, "verified": false, "followers_count": 118, "friends_count": 180, "listed_count": 2, "favourites_count": 319, "statuses_count": 10221, "created_at": "Thu Aug 05 20:03:16 +0000 2010", "utc_offset": -36000, "time_zone": "Hawaii", "geo_enabled": false, "lang": "en", "contributors_enabled": false}所以我有兩種鍵,據(jù)我所知是: import jsonwith open('salida_tweets.txt') as f: for line in f: texto=json.loads(line) objetos=texto.get('text') print(objetos)沒(méi)有任何@Brenamae_ 我拍拍你的鰭并告訴你最后一次:去AWHALE但是在打印中,第一個(gè)仍然顯示為“無(wú)”,我需要干凈的文本將其與另一個(gè)文件混合。有人能幫我嗎?
查看完整描述