'extract comments and tags beautifulsoup

i want to extract comments and tags from html file

i want to check if its a tag or its a comment to do the next process

    for element in soup.findAll(text=is_comment):
        if isinstance(element, Comment) :
              ....
        

        


Solution 1:[1]

I had the same problem with me just a before tab was not working and I solved it just pressing ctrl+m shortcut on Windows.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abduboriy Jonmirzayev