Skip to content

Instantly share code, notes, and snippets.

@brenorb
Created June 3, 2021 20:24
Show Gist options
  • Save brenorb/761e71307c4cea2320f9da57dd4013d1 to your computer and use it in GitHub Desktop.
Save brenorb/761e71307c4cea2320f9da57dd4013d1 to your computer and use it in GitHub Desktop.
🏷️ Display all unique HMTL Tags from file
# How to use it
# > python -m tag html_file
# {'tag', 'other_tag', ...}
from bs4 import BeautifulSoup
import sys
file = sys.argv[1]
with open(file, encoding='utf-8') as f:
html = f.read()
soup = BeautifulSoup(html, "html.parser")
print(set(tag.name for tag in soup.find_all()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment