最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

GitHub项目探索之一

XAMPP教程 中文小张 1151浏览 0评论

1、项目介绍

引用NWS(National Weather Service)的feed,输出天气的Alerts。

2、安装:

1 pip install -U weatheralerts

Snap18198

3、使用

导入WeatherAlerts类,然后创建WeatherAlerts的实例化对象,实例化时可选参数有:区域代码、州名。

1 from weatheralerts import WeatherAlerts
2
3 # Alerts by a Samecode
4 nws = WeatherAlerts(samecodes='016027')
5 for alert in nws.alerts:
6     print alert.title
7
8 # Alerts for a list of Samecodes
9 nws = WeatherAlerts(samecodes=['016027','016001','016073','016075'])
10 for alert in nws.alerts:
11     print alert.title
12
13 # Alerts for a State
14 nws = WeatherAlerts(state='ID')
15 for alert in nws.alerts:
16     print "{0}:  {1}".format(alert.areadesc, alert.title)

在Pycharm中的运行结果:
Snap18199

转载请注明:XAMPP中文组官网 » GitHub项目探索之一

您必须 登录 才能发表评论!