Skip to content

Instantly share code, notes, and snippets.

@majorpakhom
Created July 30, 2014 20:33
Show Gist options
  • Save majorpakhom/2d04088be1e1786c002f to your computer and use it in GitHub Desktop.
Save majorpakhom/2d04088be1e1786c002f to your computer and use it in GitHub Desktop.
import re
def get_tag(body,tag):
T = re.findall('<%s.*?>(.*?)</%s>' % (tag,tag),body,re.S)
if T: return T[0]
else: return ''
def main():
page = open("check.html", "rb").read().decode('utf-8')
print(get_tag(page,"title"))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment