Applying language filter to Entrez.esearch and Entrez.efetch


I’m querying PubMed for some results using Biopython. This is a portion of the code:

def search(query): = '[email protected]'
        handle = Entrez.esearch(db   = 'pubmed',
                                sort = 'relevance',
                                retmax = '30000',
                                retmode = 'xml',
                                term = query)
        results =
        return results

I want to the results to have papers only in English. I checked the documentation at but found no attributes for this filter.

PubMed‘s manual search allows filtering by language. How should I modify the code?

Asked By: kurious



You can modify the search term as shown below:

query = "{} AND English[Language]".format(query)

handle = Entrez.esearch(db='pubmed',
Answered By: xbello

You may add to your query an English filter, like so:

query = "{} AND english[Filter]".format(query)
Answered By: Dimitris Patikas
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.