title: Getting attribute's value using BeautifulSoup
body: <p>I'm writing a python script which will extract the script locations after parsing from a webpage. 
  Lets say there are two scenarios : </p>
  
  <pre><code>&lt;script type="text/javascript" src="http://example.com/something.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;script&gt;some JS&lt;/script&gt;
  </code></pre>
  
  <p>I'm able to get the JS from the second scenario, that is when the JS is written within the  tags. </p>
  
  <p>But is there any way, I could get the value of src from the first scenario (i.e extracting all the values of src tags within script such as <a href="http://example.com/something.js">http://example.com/something.js</a>)</p>
  
  <p>Here's my code</p>
  
  <pre><code>#!/usr/bin/python
  
  import requests 
  from bs4 import BeautifulSoup
  
  r  = requests.get("http://rediff.com/")
  data = r.text
  soup = BeautifulSoup(data)
  for n in soup.find_all('script'):
      print n 
  </code></pre>
  
  <p><strong>Output</strong> : Some JS</p>
  
  <p><strong>Output Needed</strong> : <a href="http://example.com/something.js">http://example.com/something.js</a></p>