私はこのデータをJSONファイルJSONファイルからnull値、false値を削除するにはどうすればよいですか?
{
"in_reply_to_screen_name": null,
"favorited": false,
"id_str": "92",
"entities": {
"user_mentions": [],
"symbols": [],
"urls": [],
"hashtags": [
{
"indices": [0,8]
}
]
},
"geo": null,
"user": {
"verified": false,
"notifications": null,
"profile_sidebar_border_color": "FFFFFF",
"geo_enabled": true,
"profile_background_tile": true,
"url": null,
"id": 278,
"default_profile": false,
"lang": "pt",
"location": null,
"translator_type": "none",
"protected": false
},
"id": 92,
"in_reply_to_status_id_str": null,
"in_reply_to_status_id": null,
"created_at": "Tue Oct",
"is_quote_status": false,
"text": "This is a vdd",
"truncated": false,
"retweeted": false
}
どのように私は、Pythonを使用して、このファイルの、ヌル虚偽と真実含むすべてのキーと値のペアを削除することができますがありますか?
これらの値は、データ構造のさまざまなレベルで表示されます。
あなたがこれまでに試してみましたか? –
タイトルには「null、false」(つまり「偽」)の値が記載されていますが、質問テキストには「null、false **、true **」と記載されているのが不思議です。どちらですか? – alexis
@KevinJohnson、例えば次の手順:Fとしてオープン(arq_geral、R '')を有する:Fの行のための :dados_tweetでつぶやきのため ツイート= json.loads(ライン) dados_tweet.append(つぶやき) : tweet ["geo"]: del tweet ["geo"] たとえば、 'geo'は削除されません。 –