#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import re URLS = [ ("Original games", "http://boards.openpandora.org/index.php/topic/12167-voting-original-games/"), ("Emulators","http://boards.openpandora.org/index.php/topic/12166-voting-emulators/"), ("Ported Games","http://boards.openpandora.org/index.php/topic/12168-voting-ported-games/"), ("Applications","http://boards.openpandora.org/index.php/topic/12169-voting-applications/"), ] FIRST = "first choice?" SECOND = "second choice?" THIRD = "third choice?" for category, url in URLS: try: import urllib.request response = urllib.request.urlopen(url) text = str(response.read()) text = text.replace(r"\t", "").replace(r"\n", "").replace(r"\'", "'") except ImportError: import urllib2 response = urllib2.urlopen(url) text = str(response.read()) text = text.replace("\t", "").replace("\n", "") text1 = text.split(FIRST)[1] text1 = text1.split(SECOND)[0] text2 = text.split(SECOND)[1] text2 = text2.split(THIRD)[0] text3 = text.split(THIRD)[1] text3 = text3.split("