Python Forum
IPython Notebook - How to use a class you have written
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IPython Notebook - How to use a class you have written
#2
(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.text
Using 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
Reply


Messages In This Thread
RE: IPython Notebook - How to use a class you have written - by snippsat - Mar-23-2019, 11:56 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020