摘要:
import requests import pygal # 执行API调用并存储响应 url = 'https://api.github.com/search/repositories?q=language:python&sort=stars' # 获取响应对象 r = requests.get(url) # status_code属性,是否请求成功,200代表请求成功 print("Sta...
阅读全文
posted @ 2018-03-16 13:41
ghgxm520
阅读(210)
推荐(0)
编辑
摘要:
import matplotlib.pyplot as plt from random import randint x_scatter=[] for num in range(1,1000): new= randint(1,100) x_scatter.append(new) y_scatter=[] for y in range(1,1000): yy=randint...
阅读全文
posted @ 2018-03-16 12:19
ghgxm520
阅读(312)
推荐(0)
编辑
摘要:
from random import choice import matplotlib.pyplot as plt class RandomWalk(): """随机漫步的类,三个参数:1,移动的步数;2,x的坐标点;3,y的坐标""" def __init__(self,floots=5000): self.floots=floots self....
阅读全文
posted @ 2018-03-16 12:17
ghgxm520
阅读(212)
推荐(0)
编辑
摘要:
import csv from matplotlib import pyplot as plt from datetime import datetime with open("sitka_weather_2014.csv") as f: reader= csv.reader(f) #创建阅读对象 header_row= next(reader) #读取首行,接下来...
阅读全文
posted @ 2018-03-16 11:44
ghgxm520
阅读(614)
推荐(0)
编辑
摘要:
from random import randint import pygal class Die(): def __init__(self,num_sides=6): self.num_sides=num_sides def roll(self): return randint(1,self.num_sides) def get_cou...
阅读全文
posted @ 2018-03-16 11:41
ghgxm520
阅读(456)
推荐(0)
编辑
摘要:
import json import pygal.maps.world #引入世界地图 from pygal_maps_world.i18n import COUNTRIES #引入世界个国家 def get_country_code(country_name): """根据国家的名称,获取国家的二位简称""" for code,name in COUNTRIE...
阅读全文
posted @ 2018-03-16 11:36
ghgxm520
阅读(228)
推荐(0)
编辑
摘要:
#CSV显示GDP import csv import json import pygal.maps.world from pygal_maps_world.i18n import COUNTRIES def get_country_code(country_name): """根据国家的名称,获取国家的二位简称""" for code,name in COUNTRIES.it...
阅读全文
posted @ 2018-03-16 11:34
ghgxm520
阅读(397)
推荐(0)
编辑