いまさらだけど、Bot作る〜お天気取得〜
移転しました。
最近、いまさらだけどBotでも作りながら勉強しようと思って、Pythonやり始めてます。
お天気取得編。
#! /usr/bin/python # -*- mode:python; coding:utf-8 -*- from xml.etree.ElementTree import * import urllib2 url = "http://weather.livedoor.com/forecast/webservice/rest/v1?city=81&day=today" io = urllib2.urlopen(url) dom = ElementTree(file=io) telop = dom.findtext('telop').encode('utf-8') print telop