Created
October 8, 2014 00:07
-
-
Save elinaldosoft/a747ba3c9f66b53c7373 to your computer and use it in GitHub Desktop.
Eleicoes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2,json | |
def main(): | |
resp = json.loads(urllib2.urlopen("http://divulga.tse.jus.br/2014/divulgacao/oficial/143/dadosdivweb/br/br-0001-e001431-w.js").read()) | |
for cad in resp['cand']: | |
if (float(cad['v']) / float(resp['vv'])) * 100 > 10: | |
print "Candidado: %s: votos: %s percentual: %.2f%% de %.1f%% dos votos apurados" % (cad['nm'], cad['v'], (float(cad['v']) / float(resp['vv'])) * 100, (float(resp['ea']) / float(resp['e']) * 100)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment