以下html代码:
<div class="rating-list">
<ul class="recommend">
<li>
<span class="recommend-titleInline">Stayed April 2013, traveled as a couple</span>
<ul class="recommend-column first">
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Value</li>
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Location</li>
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Sleep Quality</li>
</ul>
<ul class="recommend-column">
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Rooms</li>
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Cleanliness</li>
<li class="recommend-answer">
<span class="rate rate_ss ss50">
<img class="sprite-ratings" src="http://c1.tacdn.com/img2/x.gif" alt="5 of 5 stars" content="5.0"/>
</span>
Service</li>
</ul>
</li>
</ul>
</div>
现在我已经使用 Beautifulsoup 获取整个标签,然后我想像这样获取“li”标签:</p>
valueRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Value')
locationRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Location')
sleepRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Sleep Quality')
roomRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Rooms')
cleanRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Cleanliness')
serviceRatingTag = subRatingListTags[i].find(name = 'li', attrs = { 'class' : 'recommend-answer' }, text = 'Service')
但似乎失败了。这六个变量都是无,这不是我所期望的。我该怎么办