Google API ãã天æ°ã®åå¾
30åããã°ã©ã ããã®740ãhttp://gauc.no-ip.org/awk-users-jp/blis.cgi/DoukakuAWK_263ã«ã¤ã³ã¹ãã¤ã¢ããã¾ããã
PythonãªããWebããã®åå¾ãXMLã®ãã¼ã¹ã楽ãã³ã§ãã
使ãæ¹
$ python tenki.py Cloudy 5 Humidity: 72% Wind: NW at 10 mph
ã½ã¼ã¹ã³ã¼ã
#! /usr/bin/python # -*- mode:python; coding:utf-8 -*- from urllib2 import urlopen from xml.dom.minidom import parseString from xml.etree.ElementTree import * io = urlopen("http://www.google.com/ig/api?weather=Nagoya") dom = ElementTree(file=io) cond = dom.find("//current_conditions") for name in ["condition", "temp_c","humidity","wind_condition"]: print cond.find(name).get("data")