2016-09-15 4 views
0

Udemyから公開コースのデータを収集し、jsonファイルにすべて格納しました。各コースには、すべてのデータが格納されるID番号があります。これらのID番号を除いて、私が望む細部を完全に列挙することができます。Pythonディクショナリインスタンスの名前を一覧表示する

これらの数字はどのようにして一覧表示できますか?ありがとう。

{ 
    "153318": 
    { 
     "lectures data": "31 lectures, 5 hours video", 
     "instructor work": "Academy Of Technical Courses, Grow Your Skills Today", 
     "title": "Oracle Applications R12 Order Management and Pricing", 
     "promotional price": "$19", 
     "price": "$20", 
     "link": "https://www.udemy.com/oracle-applications-r12-order-management-and-pricing/", 
     "instructor": "Parallel Branch Inc" 
    }, 
    "616990": 
    { 
     "lectures data": "24 lectures, 1.5 hours video", 
     "instructor work": "Learning Sans Location", 
     "title": "Cloud Computing Development Essentials", 
     "promotional price": "$19", 
     "price": "$20", 
     "link": "https://www.udemy.com/cloud-computing-development-essentials/", 
     "instructor": "Destin Learning" 
    } 
} 
+1

は、あなたのPythonコードを表示することができますか?これを行う方法は、これまでのやり方によって異なります。 –

+1

'dict.keys()'はすべてのキーを表示する必要があります –

答えて

0

キーをループ

parsed = json.loads(input) 

for key in parsed.keys(): 
    print(key) 
+0

それだけです!私は.keys()を追加しなかった。ありがとう。 –

3

あなたはそのdictionnaryのkeysをしたい、その後、Pythonの辞書にJSONを解析します。

import json 
with open('course.json') as json_file: 
    course=json.load(json_file) 

print course.keys() 


与える: [u'616990', u'153318']

関連する問題