title: Web scraping with urllib
body: <p>Im trying to do some simple web scraping and I keep getting this error, im not sure whats wrong as I am fairly new to python</p>
  
  <p>Exception: a bytes-like object is required, not 'str'</p>
  
  <pre><code>import time
  import urllib.request
  import urllib.parse
  
  
  stock = 'a'
  
  
  def finvizKeyStats(stock):
      try:
          sourceCode = urllib.request.urlopen('http://finviz.com/quote.ashx?t='+stock).read()
          pbr = sourceCode.split('P/B&lt;/td&gt;&lt;td width="8%" class="snapshot-td2" align="left"&gt;&lt;b&gt;')[1].split('&lt;/b&gt;&lt;/td&gt;')[0]
          print(pbr)
      except Exception as e:
          print('Exception:', e)
  
  finvizKeyStats('a')
  </code></pre>