Hi all! I am new to python so what I am asking might be ambitious, but I want to know if there is a way to take information from the national weather service an use it as ambient tempertures to calculate heat trabsfer problems? Any help is greatly apperciated!
how to get current weather information to my program
Collapse
X
-
Tags: None
-
There are lots of many websites now that providing a weather information. But one of the best source for that is http://weather.weatherbug.com/ you can visit that site to find what you need. -
Using the url suggested by RachelCook and a specific locale, the following will extract the high and low temperatures.
Code:>>> from urllib import urlopen >>> from bs4 import BeautifulSoup >>> url = "http://weather.weatherbug.com/MN/Wahkon-weather.html?zcode=z6286&zip=56386" >>> soup = BeautifulSoup(urlopen(url).read()) >>> soup.find(name="span", id="divHi").get_text() u'33\xb0F' >>> soup.find(name="span", id="divLo").get_text() u'28\xb0F' >>>
Comment
-
Comment