python for android : 天气预报 API
2013-12-21 17:10
253 查看
参考 http://code.google.com/p/sl4a-chinese/wiki/ApiReference
感谢 http://blog.csdn.net/hello_haozi/article/details/7564223
weatherinfo1.py
感谢 http://blog.csdn.net/hello_haozi/article/details/7564223
weatherinfo1.py
# -*- coding: utf8 -*- import android import urllib import urllib2 import json import sys reload(sys) sys.setdefaultencoding('utf-8') droid = android.Android() cityid = droid.dialogGetInput(u"天气预报 API",u"请输入6位数cityid:",u'280101').result print cityid url = u'http://www.weather.com.cn/data/sk/101%s.html' % cityid handler = urllib2.urlopen(url) data = handler.read() handler.close() js = json.loads(data[15:-1]) print '城市:',js["city"],js["cityid"],'时间:',js["time"] print '温度:',js["temp"]+'℃','风向:',js["WD"],'风力:',js["WS"],'湿度:',js["SD"] url = u'http://www.weather.com.cn/data/cityinfo/101%s.html' % cityid handler = urllib2.urlopen(url) data = handler.read() handler.close() js = json.loads(data[15:-1]) print '预报温度:',js["temp1"]+'~'+js["temp2"],'天气:',js["weather"]
相关文章推荐
- python for android : 一个单选列表的天气预报例子
- bsh for android : 天气预报 API
- python for android : 一个多选列表的天气预报例子
- android天气预报----google开源天气API,SAX解析
- android天气预报----google开源天气API,SAX解析
- Android程序之全国天气预报查询API调用
- Android实战--天气预报(API+JSON解析)
- Android 利用高德地图API进行定位、开发电子围栏、天气预报、轨迹记录、搜索周边(位置)
- Android中Yahoo天气预报API的使用
- android免费天气预报接口api
- Python小工具——通过API获取天气预报
- Android手机集成天气预报功能方案:全国天气预报查询API调用
- 开源免费天气预报接口API(国家气象局提供)
- Android Studio中关联源码(source for Android API)的方法
- ArcGIS API for Android 案例教程 3
- Python爬天气预报,再发到自己的邮箱
- android版天气预报程序开发总结
- python requests练手——和风天气api
- Python调用百度API之天气查询
- Ajax 通过城市名获取数据(全国天气预报API)