Last active
December 17, 2015 09:29
-
-
Save jgomo3/5587712 to your computer and use it in GitHub Desktop.
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
# Código que solo satisface el req 2 | |
class CNEEnlacesParser(HTMLParser): | |
def __init__(self): | |
self.enlaces = [] | |
def handle_starttag(self, tag, attrs): | |
dict_attrs = dict(attrs) | |
si el tag es un "a" y tiene como atributos "id"=="region_ref" y "href": | |
enlaces.append(dict_attrs["href"]) | |
def obtener_enlaces_cne_elec_pres_2013(html): | |
cne_enlace_parser = CNEEnlacesParser() | |
cne_enlace_parser.feed(html) | |
return cne_enlace_parser.enlaces |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment