How would you count how many opening HTML tags there were & then closing tags in a line?
eg
for line in something:
for match in re.match("[I]opening_regex_here[/I]",line):
# will match <H1> or <html> or whatever
opentags += 1
for match in re.match("[I]closing_regex_here[/I]",line):
# will match <H1> or </html> or </whatever>
closingtags += 1