Created
September 20, 2012 15:25
-
-
Save krmaxwell/3756577 to your computer and use it in GitHub Desktop.
Meta tags and BeautifulSoup
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
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(response) | |
metatags = soup.find_all('meta',attrs={'name':'generator'}) | |
for tag in metatags: | |
print tag |
I am trying to find a way of parsing the meta tags into either an array or JSON as name value pairs - i.e [{'name':'title','content':'my title'},{'name':'url','content':'https//www.url.com'}]?
thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your solution :)