【发布时间】:2021-06-29 12:02:28
【问题描述】:
我有一个很大的字典列表,但我只想要字典列表中的特定信息。
如何从这个 dict 列表中获取 key standard: ('standard': {'width': 640, 'height': 480, 'url': 'the url here'}) 的值?
{'snippet': {'videoOwnerChannelId': 'UCG8rbF3g2AMX70yOd8vqIZg', 'channelTitle': 'Logan Paul', 'videoOwnerChannelTitle': 'Logan Paul', 'playlistId': 'PLH3cBjRCyTTxIGl0JpLjJ1vm60S6oenaa', 'description': 'Join the movement. Be a Maverick ► https://ShopLoganPaul.com/\nIn front of everybody...\nSUBSCRIBE FOR DAILY VLOGS! ►\nWatch Previous Vlog ► https://youtu.be/kOGkeS4Jbkg\n\nADD ME ON:\nINSTAGRAM: https://www.instagram.com/LoganPaul/\nTWITTER: https://twitter.com/LoganPaul\n\nI’m a 23 year old manchild living in Los Angeles. This is my life.\nhttps://www.youtube.com/LoganPaulVlogs', 'channelId': 'UCG8rbF3g2AMX70yOd8vqIZg', 'title': 'THE MOST EMBARRASSING MOMENT OF MY LIFE - CHOCH TALES EP. 5', 'resourceId': {'videoId': 'ft6FthsVWaY', 'kind': 'youtube#video'}, 'thumbnails': {'medium': {'width': 320, 'height': 180, 'url': 'https://i.ytimg.com/vi/ft6FthsVWaY/mqdefault.jpg'}, 'standard': {'width': 640, 'height': 480, 'url': 'https://i.ytimg.com/vi/ft6FthsVWaY/sddefault.jpg'}, 'high': {'width': 480, 'height': 360, 'url': 'https://i.ytimg.com/vi/ft6FthsVWaY/hqdefault.jpg'}, 'default': {'width': 120, 'height': 90, 'url': 'https://i.ytimg.com/vi/ft6FthsVWaY/default.jpg'}, 'maxres': {'width': 1280, 'height': 720, 'url': 'https://i.ytimg.com/vi/ft6FthsVWaY/maxresdefault.jpg'}}, 'position': 4, 'publishedAt': '2019-03-19T02:00:20Z'}, 'id': 'UExIM2NCalJDeVRUeElHbDBKcExqSjF2bTYwUzZvZW5hYS4wOTA3OTZBNzVEMTUzOTMy', 'etag': 'UU0sUEMm-gC0bcXTF9v1pFV9ZJY', 'kind': 'youtube#playlistItem'}
【问题讨论】:
-
我不明白...你想获取什么信息?
-
字典缩略图中的信息>>标准
-
你的意思是
print(d["snippet"]["thumbnails"]["standard"])吗? -
@AndrejKesely 是的
标签: python list dictionary for-loop