what is wrong with my code?

i want to download abstracts of research paper from pubmed

and eliminate '.' and divide them by ' '

so i write this code:

for pubmed_id in record['IdList']:

        abstract = Entrez.efetch('pubmed', id=pubmed_id, retmode='text', rettype='abstracts')



keywords_in_abstract = []

for ab in downloaded_abstracts:

        keyword_box = []

        words = ab.replace('.', '').split(' ')

        for w in words:

                if w.upper() == disease:



                        if w in name_kegg:

                                keyword_box.append( name_kegg[w] )




but this error happens.

Traceback (most recent call last):

  File "C:/python/home.py", line 55, in

    words = ab.replace('.', '').split(' ')

builtins.AttributeError: '_io.TextIOWrapper' object has no attribute 'replace'


How can I solve this problem?

Answers 0

Related Articles