Skip to content

extract informaton #3

@JayakumarMalla

Description

@JayakumarMalla

H Ashaywalke,

can you explain in detail about this

def extract_information(string):
string.replace (" ", "+")
query = string
soup = BeautifulSoup(urlopen("https://en.wikipedia.org/wiki/" + query), "html.parser")
#creates soup and opens URL for Google. Begins search with site:wikipedia.com so only wikipedia
#links show up. Uses html parser.
for item in soup.find_all('div', attrs={'id' : "mw-content-text"}):
print(item.find('p').get_text())
print('\n')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions