DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Thai Election ID Checking

  • submit to reddit
        The online service <a href=>here</a> aims to help people
check where they are to vote. However, it can be
used as ID certification as well.
# nnnn is the id to be checked
Here I make it into a function call.
import urllib, re
def getname(id):
  url = '' + str(id)
  src = urllib.urlopen(url).read()
  pat = '<H3> *(.*?) *<'
  name = re.findall(pat, src)[0]  # don't use other info
  return name

print getname(5100900050063)  # show a name (one of my relatives)