python显示天气预报

yipeiwu_com6年前Python基础

复制代码 代码如下:

import urllib2
import json
import string
url ='http://m.weather.com.cn/data/101090502.html'
re = urllib2.urlopen(url).read()
we = json.loads(re)['weatherinfo']
print we['city'] , we['date_y'].center(30) ,   we['week']
print we['temp1'], we['weather1'].center(30),  we['wind1']
print we['temp2'], we['weather2'].center(30),  we['wind2']
print we['temp3'], we['weather3'].center(30),  we['wind3']
print we['temp4'], we['weather4'].center(30),  we['wind4']
print we['temp5'], we['weather5'].center(30),  we['wind5']
print we['temp6'], we['weather6'].center(30),  we['wind6']
print we['index48_d']
raw_input('plese input Enter to esc')

相关文章

python同时给两个收件人发送邮件的方法

本文实例讲述了python同时给两个收件人发送邮件的方法。分享给大家供大家参考。具体分析如下: 该范例通过python内置的smtplib包发送邮件 import smtplib i...

python实现百万答题自动百度搜索答案

python实现百万答题自动百度搜索答案

用python搭建百万答题、自动百度搜索答案。 使用平台 windows7 python3.6 MIX2手机 代码原理 手机屏幕内容同步到pc端 对问题截图 对截图文字分析 用浏览器自...

Python内存读写操作示例

Python内存读写操作示例

本文实例讲述了Python内存读写操作。分享给大家供大家参考,具体如下: Python中的读写不一定只是文件,还有可能是内存,所以下面实在内存中的读写操作 示例1: # -*- co...

Caffe均值文件mean.binaryproto转mean.npy的方法

mean.binaryproto转mean.npy 使用Caffe的C++接口进行操作时,需要的图像均值文件是pb格式,例如常见的均值文件名为mean.binaryproto;但在使用p...

Flask框架模板渲染操作简单示例

本文实例讲述了Flask框架模板渲染操作。分享给大家供大家参考,具体如下: from flask import render_template from flask import F...