I would like your advice/help on this:
Create a python script that:
- Every hour collect the temperature (e.g. 29oC) and current condition (e.g. Clear) from this website: http://www.wunderground.com/global/stations/54511.html
- Create a CSV file with three headers:
- Datetime (timestamp of data captured)
- Current Condition
- Temperature
Add the data collected from the website into a new line of the CSV file.
Rules:
- The script must be running on your computer automatically for 5 days.
Do you have some advice? :(
I appreciate your help on this.
I tried this :
import urllib2
import cookielib
cookieJar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar))
setURL = 'http://www.wunderground.com/global/stations/54511.html?MR=1'
request = urllib2.Request(setURL)
response = opener.open(request)
url = "http://www.wunderground.com/global/stations/54511.html?MR=1"
request = urllib2.Request(url)
page = opener.open(request)
WeatherData = page.read()
print WeatherData
So it print all the data but I want to print only the :
Datetime (timestamp of data captured) - Current Condition - Temperature
like I said need advice.like :
what should I use to complete this task.
How can set the data collect for (days), I don't know..
I don't need the full answer and copy paste, I'm not fool...
I want to UNDERSTAND.