Skip to content

Instantly share code, notes, and snippets.

@cyb3rsalih
Created January 9, 2023 08:03
Show Gist options
  • Save cyb3rsalih/f09f26c7dec847b45153e40826177877 to your computer and use it in GitHub Desktop.
Save cyb3rsalih/f09f26c7dec847b45153e40826177877 to your computer and use it in GitHub Desktop.
Remove HTML elements from a file
import re
mext = ''
with open('html.txt', 'r') as f:
text = f.read()
mext = re.sub('<[^<]+?>', '', text)
with open('without_html.txt', 'w') as x:
x.write(mext)
# Thanks ChatGPT Assistant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment