python顯示天氣預(yù)報(bào)
更新時(shí)間:2014年03月02日 09:55:14 作者:
這篇文章主要介紹了python顯示天氣預(yù)報(bào)功能,python2.7運(yùn)行通過,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
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')
相關(guān)文章
淺談在JupyterNotebook下導(dǎo)入自己的模塊的問題
這篇文章主要介紹了淺談在JupyterNotebook下導(dǎo)入自己的模塊的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-04-04使用keras時(shí)input_shape的維度表示問題說明
這篇文章主要介紹了使用keras時(shí)input_shape的維度表示問題說明,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-06-06python3反轉(zhuǎn)字符串的3種方法(小結(jié))
這篇文章主要介紹了python3反轉(zhuǎn)字符串的3種方法(小結(jié)),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11Python3實(shí)現(xiàn)從排序數(shù)組中刪除重復(fù)項(xiàng)算法分析
這篇文章主要介紹了Python3實(shí)現(xiàn)從排序數(shù)組中刪除重復(fù)項(xiàng)算法,結(jié)合3個(gè)完整實(shí)例形式分析了Python3針對排序數(shù)組的遍歷、去重、長度計(jì)算等相關(guān)操作技巧,需要的朋友可以參考下2019-04-04