You are viewing a single comment's thread. Return to all comments →
My Solution:
import re tagsDict = dict() for _ in range(0, int(input())): fragment = input() tags = re.findall(r'<[a-z\d]+\s?[\w\s="-:;?\[\]/]*/?>', fragment) for each in tags: tag = re.findall(r'<([a-z\d]+)', each) if tag[0] not in tagsDict.keys(): tagsDict[tag[0]] = set() for attribute in re.findall(r'\s([a-z]+)(?==)', each): tagsDict[tag[0]].add(attribute) for each in sorted(tagsDict.keys()): print(each + ":" + ",".join(sorted(tagsDict[each])))
Seems like cookies are disabled on this browser, please enable them to open this website
Detect HTML Attributes
You are viewing a single comment's thread. Return to all comments →
My Solution: