如何从字典元素中打印特定字符串?
How do I print a specific string out of a dictionary element?
已解决:它是字典中的一个键,作为列表中的一个元素嵌入
print(read[0]["Title"])
Heres a picture of the output 我正在尝试打印此摘要请求中的文章标题(第 2 行末尾)。但是,我不熟悉字典列表。
我试过拆分和切片,但那些是针对元素和字符串的。我也看过 Accessing elements of Python dictionary by index 无济于事。
这是一些代码...
titles = Entrez.esummary(db="Pubmed", id= "31106594, 30889179")
read = Entrez.read(titles)
print(read["Title"])
我要它打印 "Development of a Molecularly Stable Gene Therapy Vector for the Treatment of RPGR-associated X-linked Retinitis Pigmentosa"
而是显示 "TypeError: list indices must be integers or slices, not str"
它是作为元素嵌入到列表中的字典中的一个键
for i in range(len(read)):
print(read[i]["Title"])
已解决:它是字典中的一个键,作为列表中的一个元素嵌入
print(read[0]["Title"])
Heres a picture of the output 我正在尝试打印此摘要请求中的文章标题(第 2 行末尾)。但是,我不熟悉字典列表。
我试过拆分和切片,但那些是针对元素和字符串的。我也看过 Accessing elements of Python dictionary by index 无济于事。 这是一些代码...
titles = Entrez.esummary(db="Pubmed", id= "31106594, 30889179")
read = Entrez.read(titles)
print(read["Title"])
我要它打印 "Development of a Molecularly Stable Gene Therapy Vector for the Treatment of RPGR-associated X-linked Retinitis Pigmentosa"
而是显示 "TypeError: list indices must be integers or slices, not str"
它是作为元素嵌入到列表中的字典中的一个键
for i in range(len(read)):
print(read[i]["Title"])