title: Getting the title using urllib
body: <p>I am supposed to write a code that goes into a web site and gets its title so here is the code i have</p>
  
  <pre><code>import urllib.request
  def findTitle(url):
      urllib.request.Request(url)
      #open url
      urllib.request.urlopen(url)
      urllib.request.urlopen(url).read().decode('utf-8')
      #set same variable equal to the end of &lt;title&gt; tag
      endTitlePos = url.find("&lt;title&gt;")
      #set variable equal to starting position of &lt;title&gt; tag
      startTitlePos  = url.find("&lt;title&gt;", endTitlePos)
      startTitlePos += len("&lt;title&gt;")
      #set new variable equal to &lt;/title&gt;
      TitleContent=url.find("&lt;/title&gt;",startTitlePos)
      #return slice of output between the two variables
      title = url[startTitlePos:endTitlePos]
      content_list=[]
      content_list.append(title)
      return content_list
  def main():
      url="https://google.com/search"
      print(findTitle(url))
  </code></pre>
  
  <p>main()</p>
  
  <p>we are using google for an example. Now its supposed to just print "google" but currently it prints "['//google.com/searc']" i am just curious what i am missing here, i mean it seems very simple but i dont know why its printing the url rather then the title and how also do i turn it form the list into a string?</p>