• Python
  • 18 lines
  • 29 views
  • Pasted by anonymous on February 22, 2015
import feedparser

url = 'http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=XXXXXXXXXXXX'
thing = feedparser.parse(url)

tod = [[],[]]

for dd in range(2):
	for x in thing.entries[dd+1].description.split():
		if x != "High:" and x != "Low:" and not "<" in x and not ">" in x and not "http" in x:
			tod[dd].append(x)

now = "Now: " + thing.entries[0].title.replace("Currently: ", "").replace(":", ",")
today = "Today: " + tod[0][2] + "/" + tod[0][0] + " ".join(tod[0][3:])
tomorrow = "Tomorrow: " + tod[0][2] + "/" + tod[0][0] + " ".join(tod[0][3:])


print now + "\n" + today + "\n" + tomorrow

Did you know? CLOSE

  • There are keyboard shortcuts!
    • When Creating A Paste
      • ALT+P Toggle Private
      • CTRL+Enter Create Paste
      • ALT+W Toggle word wrap
    • When Viewing A Paste
      • ALT+G Go to a line
      • ALT+CTRL+E Edit the paste
      • ALT+R Show the raw code
  • There are URL options!
    • When Creating A Paste
      • ?lang=Javascript to default to javascript
    • When Viewing A Paste
      • #L-N Jump to line number N
?