如何从Python中的嵌套数据结构中提取特定数据 [{“单词”:“意思”,“音标”:[{“文本”:“/”miːnɪŋ/”,“音频”:https://lex-audio.useremarkable.com/mp3/meaning_gb_1.mp3“}],“含义”:[{“词类”:“名词”,“定义”:[{“定义”:“是什么?” '是指单词、文本、概念或' “行为”,“同义词”:[“定义”,“意义”,“解释”,“外延”,“内涵”,“解释”,“阐释”,“解释”],“示例”:“例子” 印度语的意思是“突破” “释放”'}]},{“言语的一部分”:“形容词”,“定义”:[{“定义”:“有意” “传达非直接的信息” “表达的”、“同义词”:[“有意义的”、“有意义的”、“尖锐的”、“雄辩的”、“表达的”、“怀孕的”、“说话的”、“告密的”、“透露的”、“暗示的”]}]]

如何从Python中的嵌套数据结构中提取特定数据 [{“单词”:“意思”,“音标”:[{“文本”:“/”miːnɪŋ/”,“音频”:https://lex-audio.useremarkable.com/mp3/meaning_gb_1.mp3“}],“含义”:[{“词类”:“名词”,“定义”:[{“定义”:“是什么?” '是指单词、文本、概念或' “行为”,“同义词”:[“定义”,“意义”,“解释”,“外延”,“内涵”,“解释”,“阐释”,“解释”],“示例”:“例子” 印度语的意思是“突破” “释放”'}]},{“言语的一部分”:“形容词”,“定义”:[{“定义”:“有意” “传达非直接的信息” “表达的”、“同义词”:[“有意义的”、“有意义的”、“尖锐的”、“雄辩的”、“表达的”、“怀孕的”、“说话的”、“告密的”、“透露的”、“暗示的”]}]],python,data-structures,Python,Data Structures,这是格式 我想摘录: "meanings":[{"partOfSpeech":"noun","definitions":[{"definition":"A single distinct meaningful element of speech or writing, used with others (or sometimes alone) to form a sentence and

这是格式

我想摘录:

"meanings":[{"partOfSpeech":"noun","definitions":[{"definition":"A single distinct meaningful element of speech or writing, used with others (or sometimes alone) to form a sentence and typically shown with a space on either side when written or printed.",

我可以用Python怎么做。

我相信这就是您想要的

import json
data = ['[{"word":"meaning","phonetics":[{"text":"/ˈmiːnɪŋ/","audio":"https://lex-audio.useremarkable.com/mp3/meaning_gb_1.mp3"}],"meanings":[{"partOfSpeech":"noun","definitions":[{"definition":"What '  'is meant by a word, text, concept, or '  'action.","synonyms":["definition","sense","explanation","denotation","connotation","interpretation","elucidation","explication"],"example":"the '  'meaning of the Hindu word is ‘breakthrough, '  'release’"}]},{"partOfSpeech":"adjective","definitions":[{"definition":"Intended '  'to communicate something that is not directly '  'expressed.","synonyms":["meaningful","significant","pointed","eloquent","expressive","pregnant","speaking","telltale","revealing","suggestive"]}]}]}]']
json_data = json.loads(data[0])
meanings = json_data[0]['meanings']
print(meanings)
# [{'partOfSpeech': 'noun', 'definitions': [{'definition': 'What is meant by a word, text, concept, or action.', 'synonyms': ['definition', 'sense', 'explanation', 'denotation', 'connotation', 'interpretation', 'elucidation', 'explication'], 'example': 'the meaning of the Hindu word is ‘breakthrough, release’'}]}, {'partOfSpeech': 'adjective', 'definitions': [{'definition': 'Intended to communicate something that is not directly expressed.', 'synonyms': ['meaningful', 'significant', 'pointed', 'eloquent', 'expressive', 'pregnant', 'speaking', 'telltale', 'revealing', 'suggestive']}]}]


我相信这就是你想要的

import json
data = ['[{"word":"meaning","phonetics":[{"text":"/ˈmiːnɪŋ/","audio":"https://lex-audio.useremarkable.com/mp3/meaning_gb_1.mp3"}],"meanings":[{"partOfSpeech":"noun","definitions":[{"definition":"What '  'is meant by a word, text, concept, or '  'action.","synonyms":["definition","sense","explanation","denotation","connotation","interpretation","elucidation","explication"],"example":"the '  'meaning of the Hindu word is ‘breakthrough, '  'release’"}]},{"partOfSpeech":"adjective","definitions":[{"definition":"Intended '  'to communicate something that is not directly '  'expressed.","synonyms":["meaningful","significant","pointed","eloquent","expressive","pregnant","speaking","telltale","revealing","suggestive"]}]}]}]']
json_data = json.loads(data[0])
meanings = json_data[0]['meanings']
print(meanings)
# [{'partOfSpeech': 'noun', 'definitions': [{'definition': 'What is meant by a word, text, concept, or action.', 'synonyms': ['definition', 'sense', 'explanation', 'denotation', 'connotation', 'interpretation', 'elucidation', 'explication'], 'example': 'the meaning of the Hindu word is ‘breakthrough, release’'}]}, {'partOfSpeech': 'adjective', 'definitions': [{'definition': 'Intended to communicate something that is not directly expressed.', 'synonyms': ['meaningful', 'significant', 'pointed', 'eloquent', 'expressive', 'pregnant', 'speaking', 'telltale', 'revealing', 'suggestive']}]}]


欢迎来到StackOverflow@Aayus。您确定发布的数据正确吗?在第一个
[
。你需要应用哪种算法?你只需要提取一个固定文本一次,或者数据可以更改您好,欢迎使用SO。我们是来帮助您的,但我们的时间很宝贵,因此我建议您花点时间。得到答案的机会比没有要高。如果您还没有完成,请阅读。在另外,我建议你好好回答你的问题,并在你的问题中排除所有信息。欢迎来到StackOverflow@Ayush。你确定发布的数据是正确的吗?在第一个
之后有一个单引号
'
[
。你需要应用哪种算法?你只需要提取一个固定文本一次,或者数据可以更改您好,欢迎使用SO。我们是来帮助您的,但我们的时间很宝贵,因此我建议您花点时间。得到答案的机会比没有要高。如果您还没有完成,请阅读。在另外,我对你的问题提出建议,把所有的信息都放在你的问题里。