(Mar-22-2019, 12:41 AM)moga2003 Wrote: I have completed my first code in Ipython Notebook (as MSword file)Notebook has it own format
.ipynb
which can eg be shared with nbviewer,MSword should no be used to share Notebooks.Quote:I can't find any written help on how to use the class to answer these questions.Can someone please help me understand how this works?To help you get started.
The class is written so it can take in url or text(.txt) files.
They have written in internal parsing in class,eg
tag_id
is own name they made up.If parsing straight for BS it had look like this us of
id
not tag_id
:id_tag = soup.find('div', id='content-main') id_tag.textUsing class for question 1.
>>> url = 'https://www.webucator.com/how-to/william-henry-harrisons-inaugural-address.cfm' >>> ta = TextAnalyzer(url) >>> ta.set_content_to_tag('div', tag_id='content-main') >>> print("word_count", ta.word_count) word_count 8430