soup = BeautifulSoup(open('index.html'), "html.parser")
comments = soup.findAll(text=lambda text:isinstance(text, Comment))
[comment.extract() for comment in comments]
body = soup.body.contents
print(body)
soup = BeautifulSoup(open('index.html'), "html.parser")
comments = soup.findAll(text=lambda text:isinstance(text, Comment))
[comment.extract() for comment in comments]
body = soup.body.contents
print(body)