Created
January 31, 2019 05:34
-
-
Save urain39/b3fb5261f9fc8a4e33eb1a62b7f8b82d 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
def generate_urls(elems, attr="href"): | |
""" | |
@param elems: list | |
@param attr: str | |
@description generator to generate urls of elements | |
""" | |
for elem in elems: | |
if getattr(elem, "attrib", None): | |
url = elem.attrib.get(attr) | |
if url: | |
yield url | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment