Home > Software engineering >  program runs but returns no response when reading an xml file
program runs but returns no response when reading an xml file

Time:12-09

Here is the code to my program:

from bs4 import BeautifulSoup


with open('wiki_articles.xml', 'r', encoding='utf-8') as f:
    data = f.read()


bs_data = BeautifulSoup(data, "xml")

bs_title = bs_data.find_all('title')

print(bs_title)

The program runs but doesn't return anything. It quits only when I stop it. I have tried other tags and the problem still persists. The xml file is around 220 Mb and my computer is capable of running this program.

CodePudding user response:

Please make correction the parser name lxml instead of xml.

bs_data = BeautifulSoup(data, "lxml")
  • Related