I am having a problem. I have a regular expression which is looking through a rss feed for weather
url = 'http://rss.weatherzone.com.au/?u=12994-1285<=aploc&lc=9388&obs=1&fc=1&warn=1'
weather_brisbane = urlopen(url)
html_code = weather_brisbane.read()
weather_brisbane.close()
I have a regex:
weather_contents = findall('<b>(.+)</b> (.*)', html_code)
if weather_contents != []:
print 'Contents'
for section_heading in weather_contents:
print section_heading
print
I get this as a result:
Contents
('Temperature:', '20.1°C\r')
('Feels like:', '20.1°C<br />\r')
('Dew point:', '13.6°C\r')
('Relative humidity:', '66%<br />\r')
('Wind:', 'E at 2 km/h, gusting to 4 km/h\r')
('Rain:', '0.0mm since 9am<br />\r')
('Pressure:', '1024.9 hPa\r')
So my question is, is there a way to get this result:
Contents
Temperature: 20.1
Feels like: 20.1
Dew point: 13.6
Relative humidity: 66%
Wind: E at 2 km/h, gusting to 4 km/h
Rain: 0.0mm since 9am
Pressure: 1024.9 hPa
By integrating a strip() function into the already existing code.