title: Python: replace urls with title names from a string
body: <p>I would like to remove urls from a string and replace them with their titles of the original contents.</p>
  
  <p>For example:</p>
  
  <pre><code>mystring = "Ah I like this site: http://www.stackoverflow.com. Also I must say I like http://www.digg.com"
  
  sanitize(mystring) # it becomes "Ah I like this site: Stack Overflow. Also I must say I like Digg - The Latest News Headlines, Videos and Images"
  </code></pre>
  
  <p>For replacing url with the title, I have written this snipplet:</p>
  
  <pre><code>#get_title: string -&gt; string
  def get_title(url):
      """Returns the title of the input URL"""
  
      output = BeautifulSoup.BeautifulSoup(urllib.urlopen(url))
      return output.title.string
  </code></pre>
  
  <p>I somehow need to apply this function to strings where it catches the urls and converts to titles via  get_title.</p>