いまさらだけど、Bot作る〜お天気取得〜
更新日:2018.09.02
作成日:2011.11.14
最近、いまさらだけど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
参考
Related contents
![Eyecatch](https://www.meganii.com/images/nopicture.png)
TECH
2011.11.21
Pythonのループの書き方いろいろ
![Eyecatch](https://res.cloudinary.com/meganii/image/upload/c_scale,f_auto,q_auto/v1594902885/tech_ben4sq.png)
TECH
2011.11.15
Pythonでスクレイピングに挑戦。〜mixiの日記をEvernoteへ放り込みたい〜
![Eyecatch](https://res.cloudinary.com/meganii/image/upload/c_scale,f_auto,q_auto,w_1024/v1579905055/thumb_tableau_czhjxd.png)
TECH
2021.03.27
【Tableau】Personal Access TokensでTableau REST APIを利用する
![Eyecatch](https://images-fe.ssl-images-amazon.com/images/I/41Nyynhmv5L._SL160_.jpg)
TECH
2017.06.18
EDINETとXBRLとは何か?Pythonで財務諸表のデータを取得する
![Eyecatch](/images/hugo_s.png)
TECH
2016.09.06
Hugoで人気記事を表示するためJSONを返すAPIサーバを作りData-driven Contentを試してみた
![Eyecatch](https://images-fe.ssl-images-amazon.com/images/I/51YzbphP0JL._SL160_.jpg)
TECH
2016.08.13
PythonでTF-IDFによる文書推薦
![Eyecatch](https://images-fe.ssl-images-amazon.com/images/I/51%2BfZJOKEKL._SL160_.jpg)
TECH
2016.08.12
文書推薦
![Eyecatch](https://images-fe.ssl-images-amazon.com/images/I/51%2BfZJOKEKL._SL160_.jpg)
TECH
2016.08.11
Hugoで関連記事を表示する方法