As per the docs, assuming Beautiful Soup 4, matching for multiple CSS classes with strings like 'sp starGryB'
is brittle and should not be done:
soup.find_all('span', {'class': 'sp starGryB'})
# [<span class="sp starGryB">2.9</span>]
soup.find_all('span', {'class': 'starGryB sp'})
# []
CSS selectors should be used instead, like so:
soup.select('span.sp.starGryB')
# [<span class="sp starGryB">2.9</span>]
soup.select('span.starGryB.sp')
# [<span class="sp starGryB">2.9</span>]
In your case:
items = soup.select('span.sp.starGryB') + soup.select('span.sp.starBig')
or something more sophisticated like:
items = [i for s in ['span.sp.starGryB', 'span.sp.starBig'] for i in soup.select(s)]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…