• PyQt5快速开发与实战 10.1 获取城市天气预报


    PyQt5快速开发与实战

    10. 第10章 PyQt5 实战一:经典程序开发

    10.1 获取城市天气预报

    发送一个HTTP请求,然后解析请求返回的结果,最后把请求结果显示在窗口中。

    10.1.1 获取天气数据
    • 爬虫

      获取天气预报网站的HTML页面,然后使用 XPath或 BeautifulSoap解析 HTML页面的内容

    • 天气预报网站提供的API

      直接获取结构化数据

    中国天气网站

    在这里插入图片描述

    安装Requests库

    pip install requests
    
    • 1

    在这里插入图片描述

    10.1.2 获取不同城市的天气预报API

    请求地址:http://www.weather.com.cn/data/sk/城市代码.html

    城市代码:

    {
    	"城市代码": [{
    		"省": "四川",
    		"市": [{
    			"市名": "成都",
    			"编码": "101270101"
    		}, {
    			"市名": "自贡",
    			"编码": "101270301"
    		}, {
    			"市名": "绵阳",
    			"编码": "101270401"
    		}, {
    			"市名": "南充",
    			"编码": "101270501"
    		}, {
    			"市名": "达州",
    			"编码": "101270601"
    		}, {
    			"市名": "遂宁",
    			"编码": "101270701"
    		}, {
    			"市名": "广安",
    			"编码": "101270801"
    		}, {
    			"市名": "巴中",
    			"编码": "101270901"
    		}, {
    			"市名": "泸州",
    			"编码": "101271001"
    		}, {
    			"市名": "宜宾",
    			"编码": "101271101"
    		}, {
    			"市名": "内江",
    			"编码": "101271201"
    		}, {
    			"市名": "资阳",
    			"编码": "101271301"
    		}, {
    			"市名": "乐山",
    			"编码": "101271401"
    		}, {
    			"市名": "眉山",
    			"编码": "101271501"
    		}, {
    			"市名": "凉山",
    			"编码": "101271601"
    		}, {
    			"市名": "雅安",
    			"编码": "101271701"
    		}, {
    			"市名": "甘孜",
    			"编码": "101271801"
    		}, {
    			"市名": "阿坝",
    			"编码": "101271901"
    		}, {
    			"市名": "德阳",
    			"编码": "101272001"
    		}, {
    			"市名": "广元",
    			"编码": "101272101"
    		}, {
    			"市名": "攀枝花",
    			"编码": "101270201"
    		}]
    	}, {
    		"省": "江苏",
    		"市": [{
    			"市名": "南京",
    			"编码": "101190101"
    		}, {
    			"市名": "镇江",
    			"编码": "101190301"
    		}, {
    			"市名": "苏州",
    			"编码": "101190401"
    		}, {
    			"市名": "南通",
    			"编码": "101190501"
    		}, {
    			"市名": "扬州",
    			"编码": "101190601"
    		}, {
    			"市名": "宿迁",
    			"编码": "101191301"
    		}, {
    			"市名": "徐州",
    			"编码": "101190801"
    		}, {
    			"市名": "淮安",
    			"编码": "101190901"
    		}, {
    			"市名": "连云港",
    			"编码": "101191001"
    		}, {
    			"市名": "常州",
    			"编码": "101191101"
    		}, {
    			"市名": "泰州",
    			"编码": "101191201"
    		}, {
    			"市名": "无锡",
    			"编码": "101190201"
    		}, {
    			"市名": "盐城",
    			"编码": "101190701"
    		}]
    	}, {
    		"省": "重庆",
    		"市": [{
    			"市名": "重庆",
    			"编码": "101040100"
    		}, {
    			"市名": "合川",
    			"编码": "101040300"
    		}, {
    			"市名": "南川",
    			"编码": "101040400"
    		}, {
    			"市名": "江津",
    			"编码": "101040500"
    		}, {
    			"市名": "万盛",
    			"编码": "101040600"
    		}, {
    			"市名": "渝北",
    			"编码": "101040700"
    		}, {
    			"市名": "北碚",
    			"编码": "101040800"
    		}, {
    			"市名": "巴南",
    			"编码": "101040900"
    		}, {
    			"市名": "长寿",
    			"编码": "101041000"
    		}, {
    			"市名": "黔江",
    			"编码": "101041100"
    		}, {
    			"市名": "万州天城",
    			"编码": "101041200"
    		}, {
    			"市名": "万州龙宝",
    			"编码": "101041300"
    		}, {
    			"市名": "涪陵",
    			"编码": "101041400"
    		}, {
    			"市名": "开县",
    			"编码": "101041500"
    		}, {
    			"市名": "城口",
    			"编码": "101041600"
    		}, {
    			"市名": "云阳",
    			"编码": "101041700"
    		}, {
    			"市名": "巫溪",
    			"编码": "101041800"
    		}, {
    			"市名": "奉节",
    			"编码": "101041900"
    		}, {
    			"市名": "巫山",
    			"编码": "101042000"
    		}, {
    			"市名": "潼南",
    			"编码": "101042100"
    		}, {
    			"市名": "垫江",
    			"编码": "101042200"
    		}, {
    			"市名": "梁平",
    			"编码": "101042300"
    		}, {
    			"市名": "忠县",
    			"编码": "101042400"
    		}, {
    			"市名": "石柱",
    			"编码": "101042500"
    		}, {
    			"市名": "大足",
    			"编码": "101042600"
    		}, {
    			"市名": "荣昌",
    			"编码": "101042700"
    		}, {
    			"市名": "铜梁",
    			"编码": "101042800"
    		}, {
    			"市名": "璧山",
    			"编码": "101042900"
    		}, {
    			"市名": "丰都",
    			"编码": "101043000"
    		}, {
    			"市名": "武隆",
    			"编码": "101043100"
    		}, {
    			"市名": "彭水",
    			"编码": "101043200"
    		}, {
    			"市名": "綦江",
    			"编码": "101043300"
    		}, {
    			"市名": "酉阳",
    			"编码": "101043400"
    		}, {
    			"市名": "秀山",
    			"编码": "101043600"
    		}, {
    			"市名": "沙坪坝",
    			"编码": "101043700"
    		}, {
    			"市名": "永川",
    			"编码": "101040200"
    		}]
    	}, {
    		"省": "北京",
    		"市": [{
    			"市名": "北京",
    			"编码": "101010100"
    		}, {
    			"市名": "朝阳",
    			"编码": "101010300"
    		}, {
    			"市名": "顺义",
    			"编码": "101010400"
    		}, {
    			"市名": "怀柔",
    			"编码": "101010500"
    		}, {
    			"市名": "通州",
    			"编码": "101010600"
    		}, {
    			"市名": "昌平",
    			"编码": "101010700"
    		}, {
    			"市名": "延庆",
    			"编码": "101010800"
    		}, {
    			"市名": "丰台",
    			"编码": "101010900"
    		}, {
    			"市名": "石景山",
    			"编码": "101011000"
    		}, {
    			"市名": "大兴",
    			"编码": "101011100"
    		}, {
    			"市名": "房山",
    			"编码": "101011200"
    		}, {
    			"市名": "密云",
    			"编码": "101011300"
    		}, {
    			"市名": "门头沟",
    			"编码": "101011400"
    		}, {
    			"市名": "平谷",
    			"编码": "101011500"
    		}, {
    			"市名": "八达岭",
    			"编码": "101011600"
    		}, {
    			"市名": "佛爷顶",
    			"编码": "101011700"
    		}, {
    			"市名": "汤河口",
    			"编码": "101011800"
    		}, {
    			"市名": "密云上甸子",
    			"编码": "101011900"
    		}, {
    			"市名": "斋堂",
    			"编码": "101012000"
    		}, {
    			"市名": "霞云岭",
    			"编码": "101012100"
    		}, {
    			"市名": "北京城区",
    			"编码": "101012200"
    		}, {
    			"市名": "海淀",
    			"编码": "101010200"
    		}]
    	}, {
    		"省": "福建",
    		"市": [{
    			"市名": "福州",
    			"编码": "101230101"
    		}, {
    			"市名": "泉州",
    			"编码": "101230501"
    		}, {
    			"市名": "漳州",
    			"编码": "101230601"
    		}, {
    			"市名": "龙岩",
    			"编码": "101230701"
    		}, {
    			"市名": "晋江",
    			"编码": "101230509"
    		}, {
    			"市名": "南平",
    			"编码": "101230901"
    		}, {
    			"市名": "厦门",
    			"编码": "101230201"
    		}, {
    			"市名": "宁德",
    			"编码": "101230301"
    		}, {
    			"市名": "莆田",
    			"编码": "101230401"
    		}, {
    			"市名": "三明",
    			"编码": "101230801"
    		}]
    	}, {
    		"省": "甘肃",
    		"市": [{
    			"市名": "兰州",
    			"编码": "101160101"
    		}, {
    			"市名": "平凉",
    			"编码": "101160301"
    		}, {
    			"市名": "庆阳",
    			"编码": "101160401"
    		}, {
    			"市名": "武威",
    			"编码": "101160501"
    		}, {
    			"市名": "金昌",
    			"编码": "101160601"
    		}, {
    			"市名": "嘉峪关",
    			"编码": "101161401"
    		}, {
    			"市名": "酒泉",
    			"编码": "101160801"
    		}, {
    			"市名": "天水",
    			"编码": "101160901"
    		}, {
    			"市名": "武都",
    			"编码": "101161001"
    		}, {
    			"市名": "临夏",
    			"编码": "101161101"
    		}, {
    			"市名": "合作",
    			"编码": "101161201"
    		}, {
    			"市名": "白银",
    			"编码": "101161301"
    		}, {
    			"市名": "定西",
    			"编码": "101160201"
    		}, {
    			"市名": "张掖",
    			"编码": "101160701"
    		}]
    	}, {
    		"省": "广东",
    		"市": [{
    			"市名": "广州",
    			"编码": "101280101"
    		}, {
    			"市名": "惠州",
    			"编码": "101280301"
    		}, {
    			"市名": "梅州",
    			"编码": "101280401"
    		}, {
    			"市名": "汕头",
    			"编码": "101280501"
    		}, {
    			"市名": "深圳",
    			"编码": "101280601"
    		}, {
    			"市名": "珠海",
    			"编码": "101280701"
    		}, {
    			"市名": "佛山",
    			"编码": "101280800"
    		}, {
    			"市名": "肇庆",
    			"编码": "101280901"
    		}, {
    			"市名": "湛江",
    			"编码": "101281001"
    		}, {
    			"市名": "江门",
    			"编码": "101281101"
    		}, {
    			"市名": "河源",
    			"编码": "101281201"
    		}, {
    			"市名": "清远",
    			"编码": "101281301"
    		}, {
    			"市名": "云浮",
    			"编码": "101281401"
    		}, {
    			"市名": "潮州",
    			"编码": "101281501"
    		}, {
    			"市名": "东莞",
    			"编码": "101281601"
    		}, {
    			"市名": "中山",
    			"编码": "101281701"
    		}, {
    			"市名": "阳江",
    			"编码": "101281801"
    		}, {
    			"市名": "揭阳",
    			"编码": "101281901"
    		}, {
    			"市名": "茂名",
    			"编码": "101282001"
    		}, {
    			"市名": "汕尾",
    			"编码": "101282101"
    		}, {
    			"市名": "韶关",
    			"编码": "101280201"
    		}]
    	}, {
    		"省": "天津市",
    		"市": [{
    			"市名": "天津",
    			"编码": "101030100"
    		}, {
    			"市名": "宝坻",
    			"编码": "101030300"
    		}, {
    			"市名": "东丽",
    			"编码": "101030400"
    		}, {
    			"市名": "西青",
    			"编码": "101030500"
    		}, {
    			"市名": "北辰",
    			"编码": "101030600"
    		}, {
    			"市名": "蓟县",
    			"编码": "101031400"
    		}, {
    			"市名": "汉沽",
    			"编码": "101030800"
    		}, {
    			"市名": "静海",
    			"编码": "101030900"
    		}, {
    			"市名": "津南",
    			"编码": "101031000"
    		}, {
    			"市名": "塘沽",
    			"编码": "101031100"
    		}, {
    			"市名": "大港",
    			"编码": "101031200"
    		}, {
    			"市名": "武清",
    			"编码": "101030200"
    		}, {
    			"市名": "宁河",
    			"编码": "101030700"
    		}]
    	}, {
    		"省": "上海",
    		"市": [{
    			"市名": "上海",
    			"编码": "101020100"
    		}, {
    			"市名": "宝山",
    			"编码": "101020300"
    		}, {
    			"市名": "嘉定",
    			"编码": "101020500"
    		}, {
    			"市名": "南汇",
    			"编码": "101020600"
    		}, {
    			"市名": "浦东",
    			"编码": "101021300"
    		}, {
    			"市名": "青浦",
    			"编码": "101020800"
    		}, {
    			"市名": "松江",
    			"编码": "101020900"
    		}, {
    			"市名": "奉贤",
    			"编码": "101021000"
    		}, {
    			"市名": "崇明",
    			"编码": "101021100"
    		}, {
    			"市名": "徐家汇",
    			"编码": "101021200"
    		}, {
    			"市名": "闵行",
    			"编码": "101020200"
    		}, {
    			"市名": "金山",
    			"编码": "101020700"
    		}]
    	}, {
    		"省": "河北",
    		"市": [{
    			"市名": "石家庄",
    			"编码": "101090101"
    		}, {
    			"市名": "张家口",
    			"编码": "101090301"
    		}, {
    			"市名": "承德",
    			"编码": "101090402"
    		}, {
    			"市名": "唐山",
    			"编码": "101090501"
    		}, {
    			"市名": "秦皇岛",
    			"编码": "101091101"
    		}, {
    			"市名": "沧州",
    			"编码": "101090701"
    		}, {
    			"市名": "衡水",
    			"编码": "101090801"
    		}, {
    			"市名": "邢台",
    			"编码": "101090901"
    		}, {
    			"市名": "邯郸",
    			"编码": "101091001"
    		}, {
    			"市名": "保定",
    			"编码": "101090201"
    		}, {
    			"市名": "廊坊",
    			"编码": "101090601"
    		}]
    	}, {
    		"省": "河南",
    		"市": [{
    			"市名": "郑州",
    			"编码": "101180101"
    		}, {
    			"市名": "新乡",
    			"编码": "101180301"
    		}, {
    			"市名": "许昌",
    			"编码": "101180401"
    		}, {
    			"市名": "平顶山",
    			"编码": "101180501"
    		}, {
    			"市名": "信阳",
    			"编码": "101180601"
    		}, {
    			"市名": "南阳",
    			"编码": "101180701"
    		}, {
    			"市名": "开封",
    			"编码": "101180801"
    		}, {
    			"市名": "洛阳",
    			"编码": "101180901"
    		}, {
    			"市名": "商丘",
    			"编码": "101181001"
    		}, {
    			"市名": "焦作",
    			"编码": "101181101"
    		}, {
    			"市名": "鹤壁",
    			"编码": "101181201"
    		}, {
    			"市名": "濮阳",
    			"编码": "101181301"
    		}, {
    			"市名": "周口",
    			"编码": "101181401"
    		}, {
    			"市名": "漯河",
    			"编码": "101181501"
    		}, {
    			"市名": "驻马店",
    			"编码": "101181601"
    		}, {
    			"市名": "三门峡",
    			"编码": "101181701"
    		}, {
    			"市名": "济源",
    			"编码": "101181801"
    		}, {
    			"市名": "安阳",
    			"编码": "101180201"
    		}]
    	}, {
    		"省": "安徽",
    		"市": [{
    			"市名": "合肥",
    			"编码": "101220101"
    		}, {
    			"市名": "芜湖",
    			"编码": "101220301"
    		}, {
    			"市名": "淮南",
    			"编码": "101220401"
    		}, {
    			"市名": "马鞍山",
    			"编码": "101220501"
    		}, {
    			"市名": "安庆",
    			"编码": "101220601"
    		}, {
    			"市名": "宿州",
    			"编码": "101220701"
    		}, {
    			"市名": "阜阳",
    			"编码": "101220801"
    		}, {
    			"市名": "亳州",
    			"编码": "101220901"
    		}, {
    			"市名": "黄山",
    			"编码": "101221001"
    		}, {
    			"市名": "滁州",
    			"编码": "101221101"
    		}, {
    			"市名": "淮北",
    			"编码": "101221201"
    		}, {
    			"市名": "铜陵",
    			"编码": "101221301"
    		}, {
    			"市名": "宣城",
    			"编码": "101221401"
    		}, {
    			"市名": "六安",
    			"编码": "101221501"
    		}, {
    			"市名": "巢湖",
    			"编码": "101221601"
    		}, {
    			"市名": "池州",
    			"编码": "101221701"
    		}, {
    			"市名": "蚌埠",
    			"编码": "101220201"
    		}]
    	}, {
    		"省": "浙江",
    		"市": [{
    			"市名": "杭州",
    			"编码": "101210101"
    		}, {
    			"市名": "舟山",
    			"编码": "101211101"
    		}, {
    			"市名": "湖州",
    			"编码": "101210201"
    		}, {
    			"市名": "嘉兴",
    			"编码": "101210301"
    		}, {
    			"市名": "金华",
    			"编码": "101210901"
    		}, {
    			"市名": "绍兴",
    			"编码": "101210501"
    		}, {
    			"市名": "台州",
    			"编码": "101210601"
    		}, {
    			"市名": "温州",
    			"编码": "101210701"
    		}, {
    			"市名": "丽水",
    			"编码": "101210801"
    		}, {
    			"市名": "衢州",
    			"编码": "101211001"
    		}, {
    			"市名": "宁波",
    			"编码": "101210401"
    		}]
    	}, {
    		"省": "广西",
    		"市": [{
    			"市名": "南宁",
    			"编码": "101300101"
    		}, {
    			"市名": "柳州",
    			"编码": "101300301"
    		}, {
    			"市名": "来宾",
    			"编码": "101300401"
    		}, {
    			"市名": "桂林",
    			"编码": "101300501"
    		}, {
    			"市名": "梧州",
    			"编码": "101300601"
    		}, {
    			"市名": "防城港",
    			"编码": "101301401"
    		}, {
    			"市名": "贵港",
    			"编码": "101300801"
    		}, {
    			"市名": "玉林",
    			"编码": "101300901"
    		}, {
    			"市名": "百色",
    			"编码": "101301001"
    		}, {
    			"市名": "钦州",
    			"编码": "101301101"
    		}, {
    			"市名": "河池",
    			"编码": "101301201"
    		}, {
    			"市名": "北海",
    			"编码": "101301301"
    		}, {
    			"市名": "崇左",
    			"编码": "101300201"
    		}, {
    			"市名": "贺州",
    			"编码": "101300701"
    		}]
    	}, {
    		"省": "贵州",
    		"市": [{
    			"市名": "贵阳",
    			"编码": "101260101"
    		}, {
    			"市名": "安顺",
    			"编码": "101260301"
    		}, {
    			"市名": "都匀",
    			"编码": "101260401"
    		}, {
    			"市名": "兴义",
    			"编码": "101260906"
    		}, {
    			"市名": "铜仁",
    			"编码": "101260601"
    		}, {
    			"市名": "毕节",
    			"编码": "101260701"
    		}, {
    			"市名": "六盘水",
    			"编码": "101260801"
    		}, {
    			"市名": "遵义",
    			"编码": "101260201"
    		}, {
    			"市名": "凯里",
    			"编码": "101260501"
    		}]
    	}, {
    		"省": "云南",
    		"市": [{
    			"市名": "昆明",
    			"编码": "101290101"
    		}, {
    			"市名": "红河",
    			"编码": "101290301"
    		}, {
    			"市名": "文山",
    			"编码": "101290601"
    		}, {
    			"市名": "玉溪",
    			"编码": "101290701"
    		}, {
    			"市名": "楚雄",
    			"编码": "101290801"
    		}, {
    			"市名": "普洱",
    			"编码": "101290901"
    		}, {
    			"市名": "昭通",
    			"编码": "101291001"
    		}, {
    			"市名": "临沧",
    			"编码": "101291101"
    		}, {
    			"市名": "怒江",
    			"编码": "101291201"
    		}, {
    			"市名": "香格里拉",
    			"编码": "101291301"
    		}, {
    			"市名": "丽江",
    			"编码": "101291401"
    		}, {
    			"市名": "德宏",
    			"编码": "101291501"
    		}, {
    			"市名": "景洪",
    			"编码": "101291601"
    		}, {
    			"市名": "大理",
    			"编码": "101290201"
    		}, {
    			"市名": "曲靖",
    			"编码": "101290401"
    		}, {
    			"市名": "保山",
    			"编码": "101290501"
    		}]
    	}, {
    		"省": "内蒙古",
    		"市": [{
    			"市名": "呼和浩特",
    			"编码": "101080101"
    		}, {
    			"市名": "乌海",
    			"编码": "101080301"
    		}, {
    			"市名": "集宁",
    			"编码": "101080401"
    		}, {
    			"市名": "通辽",
    			"编码": "101080501"
    		}, {
    			"市名": "阿拉善左旗",
    			"编码": "101081201"
    		}, {
    			"市名": "鄂尔多斯",
    			"编码": "101080701"
    		}, {
    			"市名": "临河",
    			"编码": "101080801"
    		}, {
    			"市名": "锡林浩特",
    			"编码": "101080901"
    		}, {
    			"市名": "呼伦贝尔",
    			"编码": "101081000"
    		}, {
    			"市名": "乌兰浩特",
    			"编码": "101081101"
    		}, {
    			"市名": "包头",
    			"编码": "101080201"
    		}, {
    			"市名": "赤峰",
    			"编码": "101080601"
    		}]
    	}, {
    		"省": "江西",
    		"市": [{
    			"市名": "南昌",
    			"编码": "101240101"
    		}, {
    			"市名": "上饶",
    			"编码": "101240301"
    		}, {
    			"市名": "抚州",
    			"编码": "101240401"
    		}, {
    			"市名": "宜春",
    			"编码": "101240501"
    		}, {
    			"市名": "鹰潭",
    			"编码": "101241101"
    		}, {
    			"市名": "赣州",
    			"编码": "101240701"
    		}, {
    			"市名": "景德镇",
    			"编码": "101240801"
    		}, {
    			"市名": "萍乡",
    			"编码": "101240901"
    		}, {
    			"市名": "新余",
    			"编码": "101241001"
    		}, {
    			"市名": "九江",
    			"编码": "101240201"
    		}, {
    			"市名": "吉安",
    			"编码": "101240601"
    		}]
    	}, {
    		"省": "湖北",
    		"市": [{
    			"市名": "武汉",
    			"编码": "101200101"
    		}, {
    			"市名": "黄冈",
    			"编码": "101200501"
    		}, {
    			"市名": "荆州",
    			"编码": "101200801"
    		}, {
    			"市名": "宜昌",
    			"编码": "101200901"
    		}, {
    			"市名": "恩施",
    			"编码": "101201001"
    		}, {
    			"市名": "十堰",
    			"编码": "101201101"
    		}, {
    			"市名": "神农架",
    			"编码": "101201201"
    		}, {
    			"市名": "随州",
    			"编码": "101201301"
    		}, {
    			"市名": "荆门",
    			"编码": "101201401"
    		}, {
    			"市名": "天门",
    			"编码": "101201501"
    		}, {
    			"市名": "仙桃",
    			"编码": "101201601"
    		}, {
    			"市名": "潜江",
    			"编码": "101201701"
    		}, {
    			"市名": "襄樊",
    			"编码": "101200201"
    		}, {
    			"市名": "鄂州",
    			"编码": "101200301"
    		}, {
    			"市名": "孝感",
    			"编码": "101200401"
    		}, {
    			"市名": "黄石",
    			"编码": "101200601"
    		}, {
    			"市名": "咸宁",
    			"编码": "101200701"
    		}]
    	}, {
    		"省": "宁夏",
    		"市": [{
    			"市名": "银川",
    			"编码": "101170101"
    		}, {
    			"市名": "中卫",
    			"编码": "101170501"
    		}, {
    			"市名": "固原",
    			"编码": "101170401"
    		}, {
    			"市名": "石嘴山",
    			"编码": "101170201"
    		}, {
    			"市名": "吴忠",
    			"编码": "101170301"
    		}]
    	}, {
    		"省": "青海省",
    		"市": [{
    			"市名": "西宁",
    			"编码": "101150101"
    		}, {
    			"市名": "黄南",
    			"编码": "101150301"
    		}, {
    			"市名": "海北",
    			"编码": "101150801"
    		}, {
    			"市名": "果洛",
    			"编码": "101150501"
    		}, {
    			"市名": "玉树",
    			"编码": "101150601"
    		}, {
    			"市名": "海西",
    			"编码": "101150701"
    		}, {
    			"市名": "海东",
    			"编码": "101150201"
    		}, {
    			"市名": "海南",
    			"编码": "101150401"
    		}]
    	}, {
    		"省": "山东",
    		"市": [{
    			"市名": "济南",
    			"编码": "101120101"
    		}, {
    			"市名": "潍坊",
    			"编码": "101120601"
    		}, {
    			"市名": "临沂",
    			"编码": "101120901"
    		}, {
    			"市名": "菏泽",
    			"编码": "101121001"
    		}, {
    			"市名": "滨州",
    			"编码": "101121101"
    		}, {
    			"市名": "东营",
    			"编码": "101121201"
    		}, {
    			"市名": "威海",
    			"编码": "101121301"
    		}, {
    			"市名": "枣庄",
    			"编码": "101121401"
    		}, {
    			"市名": "日照",
    			"编码": "101121501"
    		}, {
    			"市名": "莱芜",
    			"编码": "101121601"
    		}, {
    			"市名": "聊城",
    			"编码": "101121701"
    		}, {
    			"市名": "青岛",
    			"编码": "101120201"
    		}, {
    			"市名": "淄博",
    			"编码": "101120301"
    		}, {
    			"市名": "德州",
    			"编码": "101120401"
    		}, {
    			"市名": "烟台",
    			"编码": "101120501"
    		}, {
    			"市名": "济宁",
    			"编码": "101120701"
    		}, {
    			"市名": "泰安",
    			"编码": "101120801"
    		}]
    	}, {
    		"省": "陕西省",
    		"市": [{
    			"市名": "西安",
    			"编码": "101110101"
    		}, {
    			"市名": "延安",
    			"编码": "101110300"
    		}, {
    			"市名": "榆林",
    			"编码": "101110401"
    		}, {
    			"市名": "铜川",
    			"编码": "101111001"
    		}, {
    			"市名": "商洛",
    			"编码": "101110601"
    		}, {
    			"市名": "安康",
    			"编码": "101110701"
    		}, {
    			"市名": "汉中",
    			"编码": "101110801"
    		}, {
    			"市名": "宝鸡",
    			"编码": "101110901"
    		}, {
    			"市名": "咸阳",
    			"编码": "101110200"
    		}, {
    			"市名": "渭南",
    			"编码": "101110501"
    		}]
    	}, {
    		"省": "山西",
    		"市": [{
    			"市名": "太原",
    			"编码": "101100101"
    		}, {
    			"市名": "临汾",
    			"编码": "101100701"
    		}, {
    			"市名": "运城",
    			"编码": "101100801"
    		}, {
    			"市名": "朔州",
    			"编码": "101100901"
    		}, {
    			"市名": "忻州",
    			"编码": "101101001"
    		}, {
    			"市名": "长治",
    			"编码": "101100501"
    		}, {
    			"市名": "大同",
    			"编码": "101100201"
    		}, {
    			"市名": "阳泉",
    			"编码": "101100301"
    		}, {
    			"市名": "晋中",
    			"编码": "101100401"
    		}, {
    			"市名": "晋城",
    			"编码": "101100601"
    		}, {
    			"市名": "吕梁",
    			"编码": "101101100"
    		}]
    	}, {
    		"省": "新疆",
    		"市": [{
    			"市名": "乌鲁木齐",
    			"编码": "101130101"
    		}, {
    			"市名": "石河子",
    			"编码": "101130301"
    		}, {
    			"市名": "昌吉",
    			"编码": "101130401"
    		}, {
    			"市名": "吐鲁番",
    			"编码": "101130501"
    		}, {
    			"市名": "库尔勒",
    			"编码": "101130601"
    		}, {
    			"市名": "阿拉尔",
    			"编码": "101130701"
    		}, {
    			"市名": "阿克苏",
    			"编码": "101130801"
    		}, {
    			"市名": "喀什",
    			"编码": "101130901"
    		}, {
    			"市名": "伊宁",
    			"编码": "101131001"
    		}, {
    			"市名": "塔城",
    			"编码": "101131101"
    		}, {
    			"市名": "哈密",
    			"编码": "101131201"
    		}, {
    			"市名": "和田",
    			"编码": "101131301"
    		}, {
    			"市名": "阿勒泰",
    			"编码": "101131401"
    		}, {
    			"市名": "阿图什",
    			"编码": "101131501"
    		}, {
    			"市名": "博乐",
    			"编码": "101131601"
    		}, {
    			"市名": "克拉玛依",
    			"编码": "101130201"
    		}]
    	}, {
    		"省": "西藏",
    		"市": [{
    			"市名": "拉萨",
    			"编码": "101140101"
    		}, {
    			"市名": "山南",
    			"编码": "101140301"
    		}, {
    			"市名": "阿里",
    			"编码": "101140701"
    		}, {
    			"市名": "昌都",
    			"编码": "101140501"
    		}, {
    			"市名": "那曲",
    			"编码": "101140601"
    		}, {
    			"市名": "日喀则",
    			"编码": "101140201"
    		}, {
    			"市名": "林芝",
    			"编码": "101140401"
    		}]
    	}, {
    		"省": "台湾",
    		"市": [{
    			"市名": "台北县",
    			"编码": "101340101"
    		}, {
    			"市名": "高雄",
    			"编码": "101340201"
    		}, {
    			"市名": "台中",
    			"编码": "101340401"
    		}]
    	}, {
    		"省": "海南省",
    		"市": [{
    			"市名": "海口",
    			"编码": "101310101"
    		}, {
    			"市名": "三亚",
    			"编码": "101310201"
    		}, {
    			"市名": "东方",
    			"编码": "101310202"
    		}, {
    			"市名": "临高",
    			"编码": "101310203"
    		}, {
    			"市名": "澄迈",
    			"编码": "101310204"
    		}, {
    			"市名": "儋州",
    			"编码": "101310205"
    		}, {
    			"市名": "昌江",
    			"编码": "101310206"
    		}, {
    			"市名": "白沙",
    			"编码": "101310207"
    		}, {
    			"市名": "琼中",
    			"编码": "101310208"
    		}, {
    			"市名": "定安",
    			"编码": "101310209"
    		}, {
    			"市名": "屯昌",
    			"编码": "101310210"
    		}, {
    			"市名": "琼海",
    			"编码": "101310211"
    		}, {
    			"市名": "文昌",
    			"编码": "101310212"
    		}, {
    			"市名": "保亭",
    			"编码": "101310214"
    		}, {
    			"市名": "万宁",
    			"编码": "101310215"
    		}, {
    			"市名": "陵水",
    			"编码": "101310216"
    		}, {
    			"市名": "西沙",
    			"编码": "101310217"
    		}, {
    			"市名": "南沙岛",
    			"编码": "101310220"
    		}, {
    			"市名": "乐东",
    			"编码": "101310221"
    		}, {
    			"市名": "五指山",
    			"编码": "101310222"
    		}, {
    			"市名": "琼山",
    			"编码": "101310102"
    		}]
    	}, {
    		"省": "湖南",
    		"市": [{
    			"市名": "长沙",
    			"编码": "101250101"
    		}, {
    			"市名": "株洲",
    			"编码": "101250301"
    		}, {
    			"市名": "衡阳",
    			"编码": "101250401"
    		}, {
    			"市名": "郴州",
    			"编码": "101250501"
    		}, {
    			"市名": "常德",
    			"编码": "101250601"
    		}, {
    			"市名": "益阳",
    			"编码": "101250700"
    		}, {
    			"市名": "娄底",
    			"编码": "101250801"
    		}, {
    			"市名": "邵阳",
    			"编码": "101250901"
    		}, {
    			"市名": "岳阳",
    			"编码": "101251001"
    		}, {
    			"市名": "张家界",
    			"编码": "101251101"
    		}, {
    			"市名": "怀化",
    			"编码": "101251201"
    		}, {
    			"市名": "黔阳",
    			"编码": "101251301"
    		}, {
    			"市名": "永州",
    			"编码": "101251401"
    		}, {
    			"市名": "吉首",
    			"编码": "101251501"
    		}, {
    			"市名": "湘潭",
    			"编码": "101250201"
    		}]
    	}, {
    		"省": "黑龙江",
    		"市": [{
    			"市名": "哈尔滨",
    			"编码": "101050101"
    		}, {
    			"市名": "牡丹江",
    			"编码": "101050301"
    		}, {
    			"市名": "佳木斯",
    			"编码": "101050401"
    		}, {
    			"市名": "绥化",
    			"编码": "101050501"
    		}, {
    			"市名": "黑河",
    			"编码": "101050601"
    		}, {
    			"市名": "双鸭山",
    			"编码": "101051301"
    		}, {
    			"市名": "伊春",
    			"编码": "101050801"
    		}, {
    			"市名": "大庆",
    			"编码": "101050901"
    		}, {
    			"市名": "七台河",
    			"编码": "101051002"
    		}, {
    			"市名": "鸡西",
    			"编码": "101051101"
    		}, {
    			"市名": "鹤岗",
    			"编码": "101051201"
    		}, {
    			"市名": "齐齐哈尔",
    			"编码": "101050201"
    		}, {
    			"市名": "大兴安岭",
    			"编码": "101050701"
    		}]
    	}, {
    		"省": "吉林",
    		"市": [{
    			"市名": "长春",
    			"编码": "101060101"
    		}, {
    			"市名": "延吉",
    			"编码": "101060301"
    		}, {
    			"市名": "四平",
    			"编码": "101060401"
    		}, {
    			"市名": "白山",
    			"编码": "101060901"
    		}, {
    			"市名": "白城",
    			"编码": "101060601"
    		}, {
    			"市名": "辽源",
    			"编码": "101060701"
    		}, {
    			"市名": "松原",
    			"编码": "101060801"
    		}, {
    			"市名": "吉林",
    			"编码": "101060201"
    		}, {
    			"市名": "通化",
    			"编码": "101060501"
    		}]
    	}, {
    		"省": "辽宁",
    		"市": [{
    			"市名": "沈阳",
    			"编码": "101070101"
    		}, {
    			"市名": "鞍山",
    			"编码": "101070301"
    		}, {
    			"市名": "抚顺",
    			"编码": "101070401"
    		}, {
    			"市名": "本溪",
    			"编码": "101070501"
    		}, {
    			"市名": "丹东",
    			"编码": "101070601"
    		}, {
    			"市名": "葫芦岛",
    			"编码": "101071401"
    		}, {
    			"市名": "营口",
    			"编码": "101070801"
    		}, {
    			"市名": "阜新",
    			"编码": "101070901"
    		}, {
    			"市名": "辽阳",
    			"编码": "101071001"
    		}, {
    			"市名": "铁岭",
    			"编码": "101071101"
    		}, {
    			"市名": "朝阳",
    			"编码": "101071201"
    		}, {
    			"市名": "盘锦",
    			"编码": "101071301"
    		}, {
    			"市名": "大连",
    			"编码": "101070201"
    		}, {
    			"市名": "锦州",
    			"编码": "101070701"
    		}]
    	}]
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451
    • 452
    • 453
    • 454
    • 455
    • 456
    • 457
    • 458
    • 459
    • 460
    • 461
    • 462
    • 463
    • 464
    • 465
    • 466
    • 467
    • 468
    • 469
    • 470
    • 471
    • 472
    • 473
    • 474
    • 475
    • 476
    • 477
    • 478
    • 479
    • 480
    • 481
    • 482
    • 483
    • 484
    • 485
    • 486
    • 487
    • 488
    • 489
    • 490
    • 491
    • 492
    • 493
    • 494
    • 495
    • 496
    • 497
    • 498
    • 499
    • 500
    • 501
    • 502
    • 503
    • 504
    • 505
    • 506
    • 507
    • 508
    • 509
    • 510
    • 511
    • 512
    • 513
    • 514
    • 515
    • 516
    • 517
    • 518
    • 519
    • 520
    • 521
    • 522
    • 523
    • 524
    • 525
    • 526
    • 527
    • 528
    • 529
    • 530
    • 531
    • 532
    • 533
    • 534
    • 535
    • 536
    • 537
    • 538
    • 539
    • 540
    • 541
    • 542
    • 543
    • 544
    • 545
    • 546
    • 547
    • 548
    • 549
    • 550
    • 551
    • 552
    • 553
    • 554
    • 555
    • 556
    • 557
    • 558
    • 559
    • 560
    • 561
    • 562
    • 563
    • 564
    • 565
    • 566
    • 567
    • 568
    • 569
    • 570
    • 571
    • 572
    • 573
    • 574
    • 575
    • 576
    • 577
    • 578
    • 579
    • 580
    • 581
    • 582
    • 583
    • 584
    • 585
    • 586
    • 587
    • 588
    • 589
    • 590
    • 591
    • 592
    • 593
    • 594
    • 595
    • 596
    • 597
    • 598
    • 599
    • 600
    • 601
    • 602
    • 603
    • 604
    • 605
    • 606
    • 607
    • 608
    • 609
    • 610
    • 611
    • 612
    • 613
    • 614
    • 615
    • 616
    • 617
    • 618
    • 619
    • 620
    • 621
    • 622
    • 623
    • 624
    • 625
    • 626
    • 627
    • 628
    • 629
    • 630
    • 631
    • 632
    • 633
    • 634
    • 635
    • 636
    • 637
    • 638
    • 639
    • 640
    • 641
    • 642
    • 643
    • 644
    • 645
    • 646
    • 647
    • 648
    • 649
    • 650
    • 651
    • 652
    • 653
    • 654
    • 655
    • 656
    • 657
    • 658
    • 659
    • 660
    • 661
    • 662
    • 663
    • 664
    • 665
    • 666
    • 667
    • 668
    • 669
    • 670
    • 671
    • 672
    • 673
    • 674
    • 675
    • 676
    • 677
    • 678
    • 679
    • 680
    • 681
    • 682
    • 683
    • 684
    • 685
    • 686
    • 687
    • 688
    • 689
    • 690
    • 691
    • 692
    • 693
    • 694
    • 695
    • 696
    • 697
    • 698
    • 699
    • 700
    • 701
    • 702
    • 703
    • 704
    • 705
    • 706
    • 707
    • 708
    • 709
    • 710
    • 711
    • 712
    • 713
    • 714
    • 715
    • 716
    • 717
    • 718
    • 719
    • 720
    • 721
    • 722
    • 723
    • 724
    • 725
    • 726
    • 727
    • 728
    • 729
    • 730
    • 731
    • 732
    • 733
    • 734
    • 735
    • 736
    • 737
    • 738
    • 739
    • 740
    • 741
    • 742
    • 743
    • 744
    • 745
    • 746
    • 747
    • 748
    • 749
    • 750
    • 751
    • 752
    • 753
    • 754
    • 755
    • 756
    • 757
    • 758
    • 759
    • 760
    • 761
    • 762
    • 763
    • 764
    • 765
    • 766
    • 767
    • 768
    • 769
    • 770
    • 771
    • 772
    • 773
    • 774
    • 775
    • 776
    • 777
    • 778
    • 779
    • 780
    • 781
    • 782
    • 783
    • 784
    • 785
    • 786
    • 787
    • 788
    • 789
    • 790
    • 791
    • 792
    • 793
    • 794
    • 795
    • 796
    • 797
    • 798
    • 799
    • 800
    • 801
    • 802
    • 803
    • 804
    • 805
    • 806
    • 807
    • 808
    • 809
    • 810
    • 811
    • 812
    • 813
    • 814
    • 815
    • 816
    • 817
    • 818
    • 819
    • 820
    • 821
    • 822
    • 823
    • 824
    • 825
    • 826
    • 827
    • 828
    • 829
    • 830
    • 831
    • 832
    • 833
    • 834
    • 835
    • 836
    • 837
    • 838
    • 839
    • 840
    • 841
    • 842
    • 843
    • 844
    • 845
    • 846
    • 847
    • 848
    • 849
    • 850
    • 851
    • 852
    • 853
    • 854
    • 855
    • 856
    • 857
    • 858
    • 859
    • 860
    • 861
    • 862
    • 863
    • 864
    • 865
    • 866
    • 867
    • 868
    • 869
    • 870
    • 871
    • 872
    • 873
    • 874
    • 875
    • 876
    • 877
    • 878
    • 879
    • 880
    • 881
    • 882
    • 883
    • 884
    • 885
    • 886
    • 887
    • 888
    • 889
    • 890
    • 891
    • 892
    • 893
    • 894
    • 895
    • 896
    • 897
    • 898
    • 899
    • 900
    • 901
    • 902
    • 903
    • 904
    • 905
    • 906
    • 907
    • 908
    • 909
    • 910
    • 911
    • 912
    • 913
    • 914
    • 915
    • 916
    • 917
    • 918
    • 919
    • 920
    • 921
    • 922
    • 923
    • 924
    • 925
    • 926
    • 927
    • 928
    • 929
    • 930
    • 931
    • 932
    • 933
    • 934
    • 935
    • 936
    • 937
    • 938
    • 939
    • 940
    • 941
    • 942
    • 943
    • 944
    • 945
    • 946
    • 947
    • 948
    • 949
    • 950
    • 951
    • 952
    • 953
    • 954
    • 955
    • 956
    • 957
    • 958
    • 959
    • 960
    • 961
    • 962
    • 963
    • 964
    • 965
    • 966
    • 967
    • 968
    • 969
    • 970
    • 971
    • 972
    • 973
    • 974
    • 975
    • 976
    • 977
    • 978
    • 979
    • 980
    • 981
    • 982
    • 983
    • 984
    • 985
    • 986
    • 987
    • 988
    • 989
    • 990
    • 991
    • 992
    • 993
    • 994
    • 995
    • 996
    • 997
    • 998
    • 999
    • 1000
    • 1001
    • 1002
    • 1003
    • 1004
    • 1005
    • 1006
    • 1007
    • 1008
    • 1009
    • 1010
    • 1011
    • 1012
    • 1013
    • 1014
    • 1015
    • 1016
    • 1017
    • 1018
    • 1019
    • 1020
    • 1021
    • 1022
    • 1023
    • 1024
    • 1025
    • 1026
    • 1027
    • 1028
    • 1029
    • 1030
    • 1031
    • 1032
    • 1033
    • 1034
    • 1035
    • 1036
    • 1037
    • 1038
    • 1039
    • 1040
    • 1041
    • 1042
    • 1043
    • 1044
    • 1045
    • 1046
    • 1047
    • 1048
    • 1049
    • 1050
    • 1051
    • 1052
    • 1053
    • 1054
    • 1055
    • 1056
    • 1057
    • 1058
    • 1059
    • 1060
    • 1061
    • 1062
    • 1063
    • 1064
    • 1065
    • 1066
    • 1067
    • 1068
    • 1069
    • 1070
    • 1071
    • 1072
    • 1073
    • 1074
    • 1075
    • 1076
    • 1077
    • 1078
    • 1079
    • 1080
    • 1081
    • 1082
    • 1083
    • 1084
    • 1085
    • 1086
    • 1087
    • 1088
    • 1089
    • 1090
    • 1091
    • 1092
    • 1093
    • 1094
    • 1095
    • 1096
    • 1097
    • 1098
    • 1099
    • 1100
    • 1101
    • 1102
    • 1103
    • 1104
    • 1105
    • 1106
    • 1107
    • 1108
    • 1109
    • 1110
    • 1111
    • 1112
    • 1113
    • 1114
    • 1115
    • 1116
    • 1117
    • 1118
    • 1119
    • 1120
    • 1121
    • 1122
    • 1123
    • 1124
    • 1125
    • 1126
    • 1127
    • 1128
    • 1129
    • 1130
    • 1131
    • 1132
    • 1133
    • 1134
    • 1135
    • 1136
    • 1137
    • 1138
    • 1139
    • 1140
    • 1141
    • 1142
    • 1143
    • 1144
    • 1145
    • 1146
    • 1147
    • 1148
    • 1149
    • 1150
    • 1151
    • 1152
    • 1153
    • 1154
    • 1155
    • 1156
    • 1157
    • 1158
    • 1159
    • 1160
    • 1161
    • 1162
    • 1163
    • 1164
    • 1165
    • 1166
    • 1167
    • 1168
    • 1169
    • 1170
    • 1171
    • 1172
    • 1173
    • 1174
    • 1175
    • 1176
    • 1177
    • 1178
    • 1179
    • 1180
    • 1181
    • 1182
    • 1183
    • 1184
    • 1185
    • 1186
    • 1187
    • 1188
    • 1189
    • 1190
    • 1191
    • 1192
    • 1193
    • 1194
    • 1195
    • 1196
    • 1197
    • 1198
    • 1199
    • 1200
    • 1201
    • 1202
    • 1203
    • 1204
    • 1205
    • 1206
    • 1207
    • 1208
    • 1209
    • 1210
    • 1211
    • 1212
    • 1213
    • 1214
    • 1215
    • 1216
    • 1217
    • 1218
    • 1219
    • 1220
    • 1221
    • 1222
    • 1223
    • 1224
    • 1225
    • 1226
    • 1227
    • 1228
    • 1229
    • 1230
    • 1231
    • 1232
    • 1233
    • 1234
    • 1235
    • 1236
    • 1237
    • 1238
    • 1239
    • 1240
    • 1241
    • 1242
    • 1243
    • 1244
    • 1245
    • 1246
    • 1247
    • 1248
    • 1249
    • 1250
    • 1251
    • 1252
    • 1253
    • 1254
    • 1255
    • 1256
    • 1257
    • 1258
    • 1259
    • 1260
    • 1261
    • 1262
    • 1263
    • 1264
    • 1265
    • 1266
    • 1267
    • 1268
    • 1269
    • 1270
    • 1271
    • 1272
    • 1273
    • 1274
    • 1275
    • 1276
    • 1277
    • 1278
    • 1279
    • 1280
    • 1281
    • 1282
    • 1283
    • 1284
    • 1285
    • 1286
    • 1287
    • 1288
    • 1289
    • 1290
    • 1291
    • 1292
    • 1293
    • 1294
    • 1295
    • 1296
    • 1297
    • 1298
    • 1299
    • 1300
    • 1301
    • 1302
    • 1303
    • 1304
    • 1305
    • 1306
    • 1307
    • 1308
    • 1309
    • 1310
    • 1311
    • 1312
    • 1313
    • 1314
    • 1315
    • 1316
    • 1317
    • 1318
    • 1319
    • 1320
    • 1321
    • 1322
    • 1323
    • 1324
    • 1325
    • 1326
    • 1327
    • 1328
    • 1329
    • 1330
    • 1331
    • 1332
    • 1333
    • 1334
    • 1335
    • 1336
    • 1337
    • 1338
    • 1339
    • 1340
    • 1341
    • 1342
    • 1343
    • 1344
    • 1345
    • 1346
    • 1347
    • 1348
    • 1349
    • 1350
    • 1351
    • 1352
    • 1353
    • 1354
    • 1355
    • 1356
    • 1357
    • 1358
    • 1359
    • 1360
    • 1361
    • 1362
    • 1363
    • 1364
    • 1365
    • 1366
    • 1367
    • 1368
    • 1369
    • 1370
    • 1371
    • 1372
    • 1373
    • 1374
    • 1375
    • 1376
    • 1377
    • 1378
    • 1379
    • 1380
    • 1381
    • 1382
    • 1383
    • 1384
    • 1385
    • 1386
    • 1387
    • 1388
    • 1389
    • 1390
    • 1391
    • 1392
    • 1393
    • 1394
    • 1395
    • 1396
    • 1397
    • 1398
    • 1399
    • 1400
    • 1401
    • 1402
    • 1403
    • 1404
    • 1405
    • 1406
    • 1407
    • 1408
    • 1409
    • 1410
    • 1411
    • 1412
    • 1413
    • 1414
    • 1415
    • 1416
    • 1417
    • 1418
    • 1419
    • 1420
    • 1421
    • 1422
    • 1423
    • 1424
    • 1425
    • 1426
    • 1427
    • 1428
    • 1429
    • 1430
    • 1431
    • 1432
    • 1433
    • 1434
    • 1435
    • 1436
    • 1437
    • 1438
    • 1439
    • 1440

    以北京为例:测试接口

    在这里插入图片描述

    返回参数

    名称描述
    weatherinfo消息根节点
    city城市中文名
    cityid城市ID
    temp温度
    WD风向
    WS风力
    SD湿度
    WSE风力
    time发布时间
    rain是否下雨,1有雨,0无雨
    idRadar是否有雷达图,1有,0无
    Radar雷达图编号
    import requests
    
    request = requests.get("http://www.weather.com.cn/data/sk/101010100.html")
    request.encoding = 'utf-8'
    
    print("返回结果:%s" % request.json())
    print("城市:%s" % request.json()['weatherinfo']['city'])
    print("风向:%s" % request.json()['weatherinfo']['WD'])
    print("温度:%s" % request.json()['weatherinfo']['temp'] + "℃")
    print("风力:%s" % request.json()['weatherinfo']['WS'])
    print("湿度:%s" % request.json()['weatherinfo']['SD'])
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    在这里插入图片描述

    10.1.3 界面实现

    在这里插入图片描述

    ui文件

    
    <ui version="4.0">
     <class>Formclass>
     <widget class="QWidget" name="Form">
      <property name="geometry">
       <rect>
        <x>0x>
        <y>0y>
        <width>484width>
        <height>409height>
       rect>
      property>
      <property name="windowTitle">
       <string>Formstring>
      property>
      <widget class="QGroupBox" name="groupBox">
       <property name="geometry">
        <rect>
         <x>10x>
         <y>10y>
         <width>431width>
         <height>251height>
        rect>
       property>
       <property name="title">
        <string>查询城市天气string>
       property>
       <widget class="QComboBox" name="weatherComboBox">
        <property name="geometry">
         <rect>
          <x>80x>
          <y>30y>
          <width>221width>
          <height>21height>
         rect>
        property>
        <item>
         <property name="text">
          <string>北京string>
         property>
        item>
        <item>
         <property name="text">
          <string>天津string>
         property>
        item>
        <item>
         <property name="text">
          <string>上海string>
         property>
        item>
       widget>
       <widget class="QTextEdit" name="resultText">
        <property name="geometry">
         <rect>
          <x>10x>
          <y>60y>
          <width>411width>
          <height>181height>
         rect>
        property>
       widget>
       <widget class="QLabel" name="label">
        <property name="geometry">
         <rect>
          <x>20x>
          <y>30y>
          <width>72width>
          <height>21height>
         rect>
        property>
        <property name="text">
         <string>城市string>
        property>
       widget>
      widget>
      <widget class="QPushButton" name="queryBtn">
       <property name="geometry">
        <rect>
         <x>90x>
         <y>300y>
         <width>93width>
         <height>28height>
        rect>
       property>
       <property name="text">
        <string>查询string>
       property>
      widget>
      <widget class="QPushButton" name="clearBtn">
       <property name="geometry">
        <rect>
         <x>230x>
         <y>300y>
         <width>93width>
         <height>28height>
        rect>
       property>
       <property name="text">
        <string>清空string>
       property>
      widget>
     widget>
     <resources/>
     <connections>
      <connection>
       <sender>clearBtnsender>
       <signal>clicked()signal>
       <receiver>Formreceiver>
       <slot>clearResult()slot>
       <hints>
        <hint type="sourcelabel">
         <x>270x>
         <y>314y>
        hint>
        <hint type="destinationlabel">
         <x>363x>
         <y>288y>
        hint>
       hints>
      connection>
      <connection>
       <sender>queryBtnsender>
       <signal>clicked()signal>
       <receiver>Formreceiver>
       <slot>queryWeather()slot>
       <hints>
        <hint type="sourcelabel">
         <x>161x>
         <y>313y>
        hint>
        <hint type="destinationlabel">
         <x>64x>
         <y>286y>
        hint>
       hints>
      connection>
     connections>
     <slots>
      <slot>clearResult()slot>
      <slot>queryWeather()slot>
     slots>
    ui>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    10.1.4 将界面文件转为.py文件

    在这里插入图片描述

    WeatherWin.py

    # -*- coding: utf-8 -*-
    
    # Form implementation generated from reading ui file 'WeatherWin.ui'
    #
    # Created by: PyQt5 UI code generator 5.9.2
    #
    # WARNING! All changes made in this file will be lost!
    
    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_Form(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(484, 409)
            self.groupBox = QtWidgets.QGroupBox(Form)
            self.groupBox.setGeometry(QtCore.QRect(10, 10, 431, 251))
            self.groupBox.setObjectName("groupBox")
            self.weatherComboBox = QtWidgets.QComboBox(self.groupBox)
            self.weatherComboBox.setGeometry(QtCore.QRect(80, 30, 221, 21))
            self.weatherComboBox.setObjectName("weatherComboBox")
            self.weatherComboBox.addItem("")
            self.weatherComboBox.addItem("")
            self.weatherComboBox.addItem("")
            self.resultText = QtWidgets.QTextEdit(self.groupBox)
            self.resultText.setGeometry(QtCore.QRect(10, 60, 411, 181))
            self.resultText.setObjectName("resultText")
            self.label = QtWidgets.QLabel(self.groupBox)
            self.label.setGeometry(QtCore.QRect(20, 30, 72, 21))
            self.label.setObjectName("label")
            self.queryBtn = QtWidgets.QPushButton(Form)
            self.queryBtn.setGeometry(QtCore.QRect(90, 300, 93, 28))
            self.queryBtn.setObjectName("queryBtn")
            self.clearBtn = QtWidgets.QPushButton(Form)
            self.clearBtn.setGeometry(QtCore.QRect(230, 300, 93, 28))
            self.clearBtn.setObjectName("clearBtn")
    
            self.retranslateUi(Form)
            self.clearBtn.clicked.connect(Form.clearResult)
            self.queryBtn.clicked.connect(Form.queryWeather)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.groupBox.setTitle(_translate("Form", "查询城市天气"))
            self.weatherComboBox.setItemText(0, _translate("Form", "北京"))
            self.weatherComboBox.setItemText(1, _translate("Form", "天津"))
            self.weatherComboBox.setItemText(2, _translate("Form", "上海"))
            self.label.setText(_translate("Form", "城市"))
            self.queryBtn.setText(_translate("Form", "查询"))
            self.clearBtn.setText(_translate("Form", "清空"))
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    10.1.5 调用主窗口类
    # -*- coding: utf-8 -*-
    
    import sys     
    from PyQt5.QtWidgets import QApplication , QMainWindow
    from WeatherWin import Ui_Form
    import requests
    
    class MainWindow(QMainWindow ):
       def __init__(self, parent=None):    
          super(MainWindow, self).__init__(parent)
          self.ui = Ui_Form()
          self.ui.setupUi(self)
          
       def queryWeather(self):
          print('* queryWeather  ')
          cityName = self.ui.weatherComboBox.currentText()
          cityCode = self.transCityName(cityName)
    
          rep = requests.get('http://www.weather.com.cn/data/sk/' + cityCode + '.html')
          rep.encoding = 'utf-8'
          print( rep.json() ) 
          
          msg1 = '城市: %s' % rep.json()['weatherinfo']['city'] + '\n'
          msg2 = '风向: %s' % rep.json()['weatherinfo']['WD'] + '\n'
          msg3 = '温度: %s' % rep.json()['weatherinfo']['temp'] + ' 度' + '\n'
          msg4 = '风力: %s' % rep.json()['weatherinfo']['WS'] + '\n'
          msg5 = '湿度: %s' % rep.json()['weatherinfo']['SD'] + '\n'
          result = msg1 + msg2 + msg3 + msg4 + msg5
          self.ui.resultText.setText(result)
          
       def transCityName(self ,cityName):
          cityCode = ''
          if cityName == '北京' :
             cityCode = '101010100'
          elif cityName == '天津' :
             cityCode = '101030100'
          elif cityName == '上海' :
             cityCode = '101020100'
             
          return cityCode
                
       def clearResult(self):
          print('* clearResult  ')
          self.ui.resultText.clear() 
          
    if __name__=="__main__":
       from pyqt5_plugins.examples.exampleqmlitem import QtCore
       QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
       app = QApplication(sys.argv)  
       win = MainWindow()  
       win.show()  
       sys.exit(app.exec_())  
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52

    在这里插入图片描述

  • 相关阅读:
    深度学习——网络中的网络以及1x1卷积
    2022-09-26 日常问题
    【Java|golang】1710. 卡车上的最大单元数---桶排序和排序对比
    关于重装系统后,Anaconda和Pycharm无法使用的问题及解决方案
    数据存储(二)WebStorage 之 IndexedDB
    振弦传感器计算公式推导及测量原理
    什么是DDoS引导程序IP Stresser?
    设计模式-备忘录模式
    win | wireshark | 在win上跑lua脚本 解析数据包
    解决问题:Unable to connect to Redis
  • 原文地址:https://blog.csdn.net/weixin_44226181/article/details/126083561