Search code examples
python-2.7biopythonpubmed

How to get the date of a PubMed publication using BioPython


I have the PubMed ID of an abstract, e.g. 10748870. I would like to get the date on which the abstract was published, using BioPython.

For example, the publication date of the article with PubMed ID 10748870 would be Dec 1999.


Solution

  • This can be done with esummary() function. The following example shows how it works:

    from Bio import Entrez
    
    Entrez.email = "your email"
    
    handle = Entrez.esummary(db="pubmed", id="10748870")
    record = Entrez.read(handle)
    handle.close()
    print(record[0]["PubDate"])