Created
September 25, 2016 09:55
-
-
Save petrushev/ec80aff9c69e6684fcfddfeb171b10b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def extractattr(attr_name): | |
def _decorator(fc): | |
def wrapped(*args, **kwargs): | |
ellist = fc(*args, **kwargs) | |
return [el.attrib[attr_name] for el in ellist] | |
return wrapped | |
return _decorator | |
def extracttext(fc): | |
def wrapped(*args, **kwargs): | |
ellist = fc(*args, **kwargs) | |
return [el.text_content() for el in ellist] | |
return wrapped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment