+ 2
crawling weather forecast ..showing error of no attribute (AttributeError: 'NoneType' object has no attribute 'end)
import re import urllib.request city = input("enter your city :" ) url = "https://www.weather-forecast.com/locations/" + city + "/forecasts/latest" data = urllib.request.urlopen(url).read() data1 = data.decode("utf-8") m = re.search('span class ="phrase">',data1) start = m.end() end = start + 100 newstring = data1[start:end] print(newstring)
1 Answer
+ 1
Check the url... +âcityâ+ .... try this...