title: HTTP Error 404: Not Found python urllib
body: <p>My code is this:</p>
  
  <pre><code>import urllib.request
  import re
  http://www.weather-forecast.com/locations/Paris/forcasts/latest
  
  city = input('Please enter a place: ')
  url = 'http://www.weather-forecast.com/locations/'+city+'forcasts/latest'
  
  data = urllib.request.urlopen(url).read()
  data1 = data.decode('utf-8')
  </code></pre>
  
  <p>I'm having trouble with the url this is my output:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "C:/Users/alext/AppData/Local/Programs/Python/Python36/Weather forecast.py", line 9, in 
        data = urllib.request.urlopen(url).read()
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 223, in urlopen
        return opener.open(url, data, timeout)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 532, in open
        response = meth(req, response)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 642, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 564, in error
        result = self._call_chain(*args)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 504, in _call_chain
        result = func(*args)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 756, in http_error_302
        return self.parent.open(new, timeout=req.timeout)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 532, in open
        response = meth(req, response)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 642, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 570, in error
        return self._call_chain(*args)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 504, in _call_chain
        result = func(*args)
      File "C:\Users\alext\AppData\Local\Programs\Python\Python36\lib\urllib          \request.py", line 650, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
        urllib.error.HTTPError: HTTP Error 404: Not Found</p>
  </blockquote>
  
  <p>I have checked the url and it is definitely correct. I have seen others with problems like this but am still unsure as to the solution. </p>