+ 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)

5th Feb 2018, 6:36 PM
Rahul Viswam
Rahul Viswam - avatar
1 Answer
+ 1
Check the url... +”city”+ .... try this...
8th Feb 2018, 3:46 AM
Christian J. Orellana F.
Christian J. Orellana F. - avatar