0

From Strip HTML from strings in Python, I got help with code

class MLStripper(HTMLParser):
def __init__(self):
    self.reset()
    self.fed = []
def handle_data(self, d):
    self.fed.append(d)
def get_data(self):
    return ''.join(self.fed)

def strip_tags(html):
    s = MLStripper()
    s.feed(html)
    return s.get_data()

for strip_tags(html), do I put an html file name as the parameter. I have a local html file called CID-Sync-0619.html at C:\Python34.

This is my code so far:

Extractfile = open("ExtractFile.txt" , "w")
Extractfile.write(strip_tags(CID-Sync-0619.html))

The entire is actually really long, but they are irrelevant to my question. I want to open another file and extract the text inside the html file to write inside that text file. How do I pass the html file as a parameter? Any help would be appreciated.

Community
  • 1
  • 1

0 Answers0