need only link as an output
<p>I have multiple html tag I want to extract only content of 1st href="..." for example this single line of data.</p>

<pre><code>&lt;a class="product-link" data-styleid="1424359" href="/tops/biba/biba-beige--pink-women-floral-print-top/1424359/buy?src=search"&gt;&lt;img _src="http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1424359/2016/9/28/11475053941748-BIBA-Beige--Pink-Floral-Print-Kurti-7191475053941511-1_mini.jpg" _src2="http://assets.myntassets.com/h_307,q_95,w_230/v1/assets/images/1424359/2016/9/28/11475053941748-BIBA-Beige--Pink-Floral-Print-Kurti-7191475053941511-1_mini.jpg" alt="BIBA Beige &amp;amp; Pink Women Floral Print Top" class="lazy loading thumb" onerror="this.className='thumb error'" onload="this.className='thumb'"/&gt;&lt;div class="brand"&gt;Biba&lt;/div&gt;&lt;div class="product"&gt;Beige &amp;amp; Pink Women Floral Print Top&lt;/div&gt;&lt;div class="price"&gt;Rs. 899&lt;/div&gt;&lt;div class="sizes"&gt;Sizes: S, L, XL, XXL&lt;/div&gt;&lt;/a&gt;
</code></pre>

<p>I want only <code>/tops/biba/biba-beige--pink-women-floral-print-top/1424359/buy?src=search</code> as output</p>

<p>The code is as follows:</p>

<pre><code>from bs4 import BeautifulSoup
import urllib

x=urllib.urlopen("http://www.myntra.com/tops-tees-menu/")
soup2 = BeautifulSoup(x, 'html.parser')
for i in soup2.find_all('a', attrs={'class': 'product-link'}):
    print i
    print i.find('a')['href']
</code></pre>

<p>If you need a single "product link", just use <code>find()</code>:</p>

<pre><code>soup2.find('a', attrs={'class': 'product-link'})["href"]
</code></pre>

<p>Note that you can use a <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors" rel="nofollow">CSS selector</a> location technique as well:</p>

<pre><code>soup2.select_one('a.product-link')["href"]
</code></pre>

python python-2.7 beautifulsoup data-cleansing