yunzhonghe71
发表于 2015-6-12 08:59:47
顶顶顶顶顶顶顶顶顶顶顶的
Utopia1126
发表于 2015-6-12 09:40:34
看看 学习
Kingo
发表于 2015-6-12 09:51:17
:lol:
王小贱ss
发表于 2015-6-12 09:57:18
{:9_232:}
昨、夜星辰
发表于 2015-6-12 12:01:28
# -*- coding: utf-8 -*-
import requests
import json
def get_weather_data():
city = input('请输入要查询的城市:')
url = 'http://wthrcdn.etouch.cn/weather_mini?city=' + city
weather_data = requests.get(url).text
weather_dict = json.loads(weather_data)
if weather_dict.get('desc') == 'OK':
print('城市:' + weather_dict.get('data').get('city'))
print('温度:' + weather_dict.get('data').get('wendu') + '℃')
print('感冒:' + weather_dict.get('data').get('ganmao'))
print('风向:' + weather_dict.get('data').get('forecast').get('fengxiang'))
print('风级:' + weather_dict.get('data').get('forecast').get('fengli'))
print('高温:' + weather_dict.get('data').get('forecast').get('high'))
print('低温:' + weather_dict.get('data').get('forecast').get('low'))
print('天气:' + weather_dict.get('data').get('forecast').get('type'))
print('日期:' + weather_dict.get('data').get('forecast').get('date'))
print('*' * 50)
key = input('是否显示未来四天的天气情况?(Y/N)')
if key == 'Y' or 'y':
for i in range(1, 5):
print('日期:' + weather_dict.get('data').get('forecast').get('date'))
print('风向:' + weather_dict.get('data').get('forecast').get('fengxiang'))
print('风级:' + weather_dict.get('data').get('forecast').get('fengli'))
print('高温:' + weather_dict.get('data').get('forecast').get('high'))
print('低温:' + weather_dict.get('data').get('forecast').get('low'))
print('天气:' + weather_dict.get('data').get('forecast').get('type'))
print('-' * 50)
else:
print('您输入的城市有误,或者天气中心未收录您输入的城市。')
get_weather_data()根据楼主的程序自己手动改写了一下~{:1_1:}
yayasamsam
发表于 2015-6-12 14:04:22
看看
blues177
发表于 2015-6-12 14:14:52
学习学习
hugaolong
发表于 2015-6-12 14:29:20
:victory:
cottons
发表于 2015-6-12 14:36:21
感谢分享,新手下来研究下
1588/足球
发表于 2015-6-12 14:48:48
学的真好 有基础吧?
Philip88
发表于 2015-6-12 15:39:21
瞧一瞧看一看
yincooujiao
发表于 2015-6-12 15:51:32
下载下来看看
大冬瓜
发表于 2015-6-12 16:09:08
研究研究
一个人的路
发表于 2015-6-12 16:38:59
:lol:
后知淡然
发表于 2015-6-12 16:59:18
学了多少天了?
一战到底
发表于 2015-6-12 17:37:02
查询天气
警察局里端茶的
发表于 2015-6-12 20:57:08
{:1_1:}
stargazeryin
发表于 2015-6-13 08:14:16
请问你学多久了才能写出这个东东???
illsuion
发表于 2015-6-13 08:47:37
很好很好
moment
发表于 2015-6-13 10:22:32
功能挺好的,想看一下如何实现的!
页:
1
2
3
[4]
5
6
7
8
9
10
11
12
13