Last active
July 17, 2017 15:25
-
-
Save marcotinacci/6fdd4c713e16145cdfbd2a3ab41b0c85 to your computer and use it in GitHub Desktop.
Python regex to remove any attribute from tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
html = "<p class='myclass'>paragraph</p>" | |
html = re.sub("<([^> /]+)[ ]?[^>]*>","<\g<1>>", html) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment