#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
Total votes count - 25402069
Invalid votes count - 304811 (0.0119994556349%)
Support Tymoshenko - 11577320 (0.455762875063%)
Support Yanukovych - 12410894 (0.488578076061%)
Against all - 1109033 (0.0436591602046%)
Source: https://habr.com/ru/post/83635/
All Articles