Created
October 2, 2018 02:42
-
-
Save kumarRaj/f91dd19843cbfdb82cce644edd06e791 to your computer and use it in GitHub Desktop.
Returns a map of all styles in the style tag
This file contains hidden or 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 | |
file = open("beautify.html", "r") | |
text = file.read() | |
lines = text.split("\n") | |
y = tuple((re.search("\w+(?=\s?{)", line), re.search("(?<={)(.*)(?=})", line)) for line in lines) | |
classes = {} | |
for element in y: | |
if element[0] is not None: | |
classes[element[0].group()] = element[1].group() | |
print ( classes ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment