Python3 处理JSON
来源:互联网 发布:java打印map 编辑:程序博客网 时间:2024/06/16 10:12
真的好简单,灰常简单
import os, io, sys, re, time, base64, json
import webbrowser, urllib.request
def main():
"main function"
url = "http://m.weather.com.cn/data/101010100.html"
stdout=urllib.request.urlopen(url)
weatherInfo= stdout.read().decode('utf-8')
#print(weatherInfo)
jsonData = json.loads(weatherInfo)
#输出JSON数据
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()
- Python3 处理JSON
- python3处理json
- 用Python3处理JSON
- python3处理不标准json数据
- python3处理不标准json数据
- Python3 JSON
- Python3 网络传输数据的处理(json / xml / base64)
- Python3 网络传输数据的处理(json / xml / base64)
- python3.2 解析JSON
- python3 解析json数据
- python3 urllib post json
- Python3 JSON 数据解析
- Python3 JSON 数据解析
- python3 json 模块
- python3 XML转Json
- Python3.2 --- 异常处理
- python3 字符编码处理
- python3时间处理
- 时序约束,STA
- Eclipse无法打开,一闪而过的解决方法
- 黑白棋游戏
- js中escape()函数和unescape()函数的功能
- Vitamio中文API文档—— MediaStore
- Python3 处理JSON
- 数据结构(C语言)读书笔记11:堆分配存储表示
- ipmitool命令
- tomcat 修改ROOT的方法
- iOS后台播放背景音乐文件
- js 判断单选按钮是否被选中
- WCF基本异常处理模式[中篇]
- 综合DC/RC--要点
- 常用eclipse快捷键myeclipse也一样