Python BeautifulSoup: wildcard attribute/id search

You can provide a callable as a filter:

dates = soup.findAll("div", {"id" : lambda L: L and L.startswith('date')})

Or as @DSM points out

dates = soup.findAll("div", {"id" : re.compile('date.*')})

as BeautifulSoup will recognise a RegExp object and call its .match() method.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)