Python: How to use BeautifulSoup to scrape the first 3 <li> elements of a ul=class?
<p>I am using the following script to scrape information to create  postal mailing labels.</p>

<p>The script scrapes all the data from the <code>ul</code> class "description keywords" tag of my counties PUBLIC tax database.</p>

<p>My problem is how do I only scrape the first 3 <code>li</code> elements of the <code>ul</code> class "description key." Take in mind that this class is used over a 100 times in the html and I only need the first 3 elements that contains the mailing address information.</p>

<p>What do I need to add to get only the <code>li</code> elements that I need?</p>

<p>The script works well, but it grabs too much information.</p>

<p>Thanks </p>

<p>The following line of code grabs all the data I need, but also gives 2 extra <code>li</code> elements that I do not need.</p>

<pre><code>a = soup.findAll(attrs={"class" : "description keywords"})
</code></pre>

<p>I need to only collect the first 3 <code>li</code> elements of the <code>ul</code> class-"description keywords"</p>
