pages = []
for sitemap in sitemaps:
pages.extend(findall('<loc>(.*)</loc>',
download(sitemap).decode()))
where,
sitemapsis a list containing the URLs for all sitemap xmls found by parsing a sitesrobots.txt- call to
downloadtakes a url and returns its html as a bytestring.
the code above return a list of URL string, which is intended. turning this into a listcomp like...
pages = [ findall('<loc>(.*)</loc>', download(sitemap).decode() for sitemap in sitemaps ]
...it will return a ragged list (of list of strings)
So, how do can i generate the desired result using listcomps?