import urllib2 import json # Look up POP in near Future def pop(a): f = urllib2.urlopen('http://api.wunderground.com/api/003508f51f58d4f4/geolookup/forecast/q/WI/Black_Earth.json') json_string = f.read() parsed_json = json.loads(json_string) pop= parsed_json['forecast']['txt_forecast']['forecastday'][a]['pop'] return pop x=pop(0) print ("Chance of rain rain today")+" "+x y=pop(1) print ("Chance of rain rain tonight")+" "+y if int(x) >=9: print ("Decent Chance of rain today") elif int(y)>=9: print ("Decent Chande of rain tonight") else: print ("low Chance of rain call program.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question