Quantcast
Channel: How to pull out and then print certain words from a link - Stack Overflow
Viewing all articles
Browse latest Browse all 4

How to pull out and then print certain words from a link

$
0
0

I am making a weather report program for homework, and it needs to print:

Today's temperatures: maximum 2ºC, minimum -1ºC

currently it prints out:

Today's temperatures:      <title>Thursday: Light Snow Shower, Maximum Temperature: 2°C (36°F) Minimum Temperature: -1°C (30°F)</title>.

How do I ensure it only prints the correct information? This is my code:

import urlliburl = 'http://open.live.bbc.co.uk/weather/feeds/en/2654993/3dayforecast.rss'web_connection = urllib.urlopen(url)for line in web_connection.readlines():    if line.find('Thursday:') != -1:        print "Today's temperatures:"+ lineweb_connection.close()

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images