sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频)

https://study.163.com/course/introduction.htm?courseId=1005269003&utm_campaign=commission&utm_source=cp-400000000398149&utm_medium=share

执行结果

详细参数

city  #城市信息
cod #内部参数
cnt #预测天数
list #信息列表,主要获取weatherData---weather---main和description信息
message #内部参数

# -*- coding: utf-8 -*-
#! python3
# quickWeather.py - Prints the current weather for a location from the command line.
"""
Created on Sat Apr 16 10:24:28 2016 @author: daxiong
""" import json, requests, sys '''
# Compute location from command line arguments.
if len(sys.argv) < 2:
print('Usage: quickWeather.py location')
sys.exit()
location = ' '.join(sys.argv[1:])
'''
#城市名称
cityName="Chongqing"
#城市ID号
cityID="1814905"
#我的免费appID
appID="0383ae59663e14ab5a6855d5b6ad5d00"
#获取天气天数
days="3"
# Download the JSON data from OpenWeatherMap.org's API
url="http://api.openweathermap.org/data/2.5/forecast/city?id=%s&APPID=%s&cnt=%s"%(cityID,appID,days)
response = requests.get(url)
response.raise_for_status() # Load JSON data into a Python variable.
weatherData = json.loads(response.text) # Print weather descriptions.
#主要获取weatherData---weather---main和description信息
w = weatherData['list']
print('Current weather in %s:' % (cityName))
print(w[0]['weather'][0]['main'], '-', w[0]['weather'][0]['description'])
print()
print('Tomorrow:')
print(w[1]['weather'][0]['main'], '-', w[1]['weather'][0]['description'])
print()
print('Day after tomorrow:')
print(w[2]['weather'][0]['main'], '-', w[2]['weather'][0]['description']) '''
len(weatherData)
Out[21]: 5
for i in weatherData:
print(i)
city #城市信息
cod #内部参数
cnt #预测天数
list #信息列表,主要获取weatherData---weather---main和description信息
message #内部参数 ''' '''
weatherData
Out[23]:
{'city': {'coord': {'lat': 30.25, 'lon': 107.75},
'country': 'CN',
'id': 1814905,
'name': 'Chongqing Shi',
'population': 0,
'sys': {'population': 0}},
'cnt': 1,
'cod': '200',
'list': [{'clouds': {'all': 44},
'dt': 1460775600,
'dt_txt': '2016-04-16 03:00:00',
'main': {'grnd_level': 937.55,
'humidity': 98,
'pressure': 937.55,
'sea_level': 1025.81,
'temp': 288.16,
'temp_kf': 0.4,
'temp_max': 288.16,
'temp_min': 287.759},
'rain': {'3h': 0.01},
'sys': {'pod': 'd'},
'weather': [{'description': 'light rain',
'icon': '10d',
'id': 500,
'main': 'Rain'}],
'wind': {'deg': 267.501, 'speed': 1.63}}],
'message': 0.0109} '''

  

获取天气预报API的更多相关文章

  1. [整]C#获取天气预报信息(baidu api)包括pm2.5

    /// <summary> /// 获取天气预报信息 /// </summary> /// <returns></returns> public Bai ...

  2. 天气预报API(四):全国城市代码列表(“新编码”)

    说明 天气预报API系列文章涉及到的天气网站10个左右,只发现了中国气象频道和腾讯天气城市代码参数特别: 暂且称 中国气象频道.腾讯天气使用的城市代码为 "新编码" 注:中国气象频 ...

  3. 聚合数据全国天气预报api接口

    查询天气预报在APP中常用的一个常用功能,聚合数据全国天气预报api接口可以根据根据城市名/id查询天气.根据IP查询天气.据GPS坐标查询天气.查询城市天气三小时预报,并且支持全国不同城市天气预报查 ...

  4. 天气预报API简单实现

    本人小白,觉得好玩,就注册了一个博客.一时也不知道写些什么,就把昨天做的一个简单的网页天气预报写一下吧,希望对各位看官有所帮助. 运行环境:php+mysql+WIN/Linux,框架什么的都无所谓了 ...

  5. Android访问中央气象台的天气预报API得到天气数据

      最新说明:该接口已失效! 2014-03-04 可申请它公布的API,需申请:http://smart.weather.com.cn/wzfw/smart/weatherapi.shtml 在用A ...

  6. (41)zabbix监控api接口性能及可用性 天气预报api为例

    现在各种应用都走api,例如淘宝,天气预报等手机.pad客户端都是走api的,那么平时也得对这些api做监控了.怎么做呢?zabbix的web监控是不二选择了.今天就以天气预报api作为一个例子. 天 ...

  7. 如何用全国天气预报API接口进行快速开发

    最近公司项目有一个全国天气预报的小需求,想着如果用现成的API就可以大大提高开发效率,在网上的API商店搜索了一番,发现了 APISpace,它里面的全国天气预报API非常符合我的开发需求.   全国 ...

  8. 天气预报API开发

    天气预报API开发 一.        寻觅篇 最近想要跟着视频练习一下利用API开发一个天气预报系统,就在网上找了一下可以用的API,结果好多都已经失效了... 1.       百度车联网天气预报 ...

  9. Struts2中获取servlet API的几种方式

    struts2是一个全新的MVC框架,如今被广大的企业和开发者所使用,它的功能非常强大.这给我们在使用servlet 纯java代码写项目的时候带来了福音.但是一般来说,我们的项目不到一定规模并不需要 ...

随机推荐

  1. Linux内核分析— —操作系统是如何工作的(20135213林涵锦)

    mykernel实验指导(操作系统是如何工作的) 实验要求 运行并分析一个精简的操作系统内核,理解操作系统是如何工作的 使用实验楼的虚拟机打开shell cd LinuxKernel/linux-3. ...

  2. 如何实现基于ssh框架的投票系统的的质量属性

    如何实现基于ssh框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...

  3. FreeMarker has_content等价于StringUtils.isNotNullOrEmpty

    has_content It is true if the variable exists (and isn't Java null) and is not "empty", ot ...

  4. 如何删除GitHub或者GitLab 上的文件夹

    如何删除GitHub或者GitLab 上的文件夹   需求分析 假设小明有一天不小心把本地仓库的一个文件夹A推送到了远程GIT服务器(例如:github,gitlab,gitee)上,此时想删除远程仓 ...

  5. 命令行方式(SSH or powershell )远程windows server

    1. 使用ssh的方式远程登录window server 网上找到的方法大部分是freesshd 或者是Copsshd这样的工具 方式就是 下载安装文件,然后服务器端进行安装: 安装完成之后作为服务启 ...

  6. ubuntu16安装MySQL

    MySQL 是一种开源数据库管理系统,通常作为流行的LAMP(Linux,Apache,MySQL,PHP / Python / Perl)堆栈的一部分安装.它使用关系数据库和SQL(结构化查询语言) ...

  7. JavaScript从入门到精通

    第一(基本语法) if(condition1){ expression1; }else if(condition2){ expression2; }else{ expression3; } switc ...

  8. Delphi动态添加菜单

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  9. java中线程安全和非线程安全的集合

    线程安全 非线程安全 Collection Vector ArrayList.LinkedList HashSet.TreeSet Map HashTable HashMap.TreeMap 字符串 ...

  10. Bash Game 巴什博弈

    巴什博弈(Bash Game,同余理论):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个.最后取光者得胜. 显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先 ...