title: BeautifulSoup: Open local and http html files
body: <p>I cannot get both working, only one or the other:</p>
  
  <pre><code>link = open(url)
  soup = BeautifulSoup(link.read(), "html.parser")
  </code></pre>
  
  <p>^ Works with local files</p>
  
  <pre><code>link = urlopen(url).read()    
  soup = BeautifulSoup(link, "html.parser")
  </code></pre>
  
  <p>^Works with http:// (internet) links</p>
  
  <p><strong>How do I simply get both working?</strong></p>