python模块学习---json
来源:互联网 发布:js微信授权获取code 编辑:程序博客网 时间:2024/05/16 17:30
import os,io,sys,re,time,base64,jsonimport webbrowser,urllib.requestdef main(): url = "http://m.weather.com.cn/data/101010100.html" stdout = urllib.request.urlopen(url) weatherinfo = stdout.read().decode('utf-8') jsonData = json.loads(weatherinfo) szCity = jsonData["weatherinfo"]["city"] print("城市:",szCity) szTemp = jsonData["weatherinfo"]["temp1"] print("温度:",szTemp) szWeather1 = jsonData["weatherinfo"]["weather1"] print("天气情况:",szWeather1) szCityid = jsonData["weatherinfo"]["cityid"] print("城市编码:",szCityid) if __name__ == '__main__': main()
在python2.x中有simplejson模块,python3.x中为json
2.7 安装simplejson步骤:
windows xp环境下,总共3个步骤:1。 下载http://pypi.python.org/pypi/simplejson/2。解压例如:下面例子解压到:D:/simplejson3。安装如下内容为Simplejson安装过程…D:/simplejson>python setup.py installOVER开始提示”Python不是内部或外部命令命令“ 添加环境变量就行了。添加到path。
0 0
- python模块学习---json
- Python模块学习之json
- 【Python学习笔记】-json模块
- 学习python 之 json模块
- python pickle模块 json模块
- python模块之JSON模块
- python-Json模块【解析Json】
- python-Json模块【解析Json】
- python-Json模块【解析Json】
- python-Json模块【解析Json】
- python解析json:json模块
- python json模块
- Python JSON模块
- Python之json模块
- Python JSON模块
- Python JSON模块
- python Json模块
- Python-json模块
- NHibernate基本应用程序配置
- 简单的双缓冲区实现
- 旋转变换
- 浅谈php正则过滤sql注入,以及跨站脚本攻击 新人学习
- 最详细的黑客教程
- python模块学习---json
- 好久没休息了
- Transparant Image Button (BMP, GIF, JPG...)
-  |"|&|<|>等html字符转义
- Android Fragment实现QQ的主界面功能
- wireshark过滤语法总结【转】
- 面试10大算法汇总+常见题目解答
- 查看Linux内核版本
- 织梦dede如何去除Power by DedeCms