所以这很好,但需要记录。get(“SO”),“?”)仅返回日记账的缩写
不,它没有。由于这条线,它甚至不会运行:
records = list(records)
像
records
idlist = record["IdList"]
['17510654', '2246389']
旨在通过
Entrez.efetch()
调用以获取实际数据。所以当你这么做的时候
record.get("SO", "?")
在其中一个数字字符串上,代码(再次)爆炸。
首先
"SO"
字段缩写定义为返回日记账标题缩写(TA),作为其返回内容的一部分。你可能想要
"JT"
日记账标题定义见
MEDLINE/PubMed Data Element (Field) Descriptions
. 但这两者都与查找无关。
from Bio import Entrez
Entrez.email = "my_email@gmail.com" # change this to be your email address
handle = Entrez.esearch(db="pubmed", term="cancer AND wombats", retmax=20)
record = Entrez.read(handle)
handle.close()
for identifier in record['IdList']:
pubmed_entry = Entrez.efetch(db="pubmed", id=identifier, retmode="xml")
result = Entrez.read(pubmed_entry)
article = result['PubmedArticle'][0]['MedlineCitation']['Article']
print('"{}" in "{}"'.format(article['ArticleTitle'], article['Journal']['Title']))
输出
> python3 test.py
"Of wombats and whales: telomere tales in Madrid. Conference on telomeres and telomerase." in "EMBO reports"
"Spontaneous proliferations in Australian marsupials--a survey and review. 1. Macropods, koalas, wombats, possums and gliders." in "Journal of comparative pathology"
>
详细信息可在文档中找到:
MEDLINE PubMed XML Element Descriptions