On Nov 17, 3:45 am, "Vladimir Rusinov" <[EMAIL PROTECTED]> wrote: > Hello! > > I'm using beautiful soup html parser, and I need to get all '<div > class=g>...</div>' tags. > It can be done by: > > import BeautifulSoup as BSoup > > ... > > soup = BSoup(page) > for div in soup.findAll('div', class='g'): > <do something> > > But how can I use `class` as kwarg name?
""" You could search by CSS class with soup.find("tagName", { "class" : "cssClass" }), but that's a lot of code for such a common operation. Instead, you can pass a string for attrs instead of a dictionary. The string will be used to restrict the CSS class. """ http://www.crummy.com/software/BeautifulSoup/documentation.html#Searching%20by%20CSS%20class George -- http://mail.python.org/mailman/listinfo/python-list