摘要: import requests url = "https://www.baidu.com/" for i in range(20): try: rest = requests.get (url,timeout=30) rest.raise_for_status() r=rest.content.de 阅读全文
posted @ 2020-12-13 19:44 我的人生不止一部戏 阅读(80) 评论(0) 推荐(0)
摘要: ndarray 多维数组对象 创建ndarray # 列表转换 data1 = [6, 7.5, 8, 0, 1] arr1 = np.array(data1) # 嵌套序列 data2 = [[1,2,3,4],[5,6,7,8]] arr2 = np.array(data2) # 其他创建数组的 阅读全文
posted @ 2020-11-23 00:56 我的人生不止一部戏 阅读(115) 评论(0) 推荐(0)
摘要: from random import random def printTntro(): print("typist : 23") print("模拟比赛") print("需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = eval(input("请输入A的能 阅读全文
posted @ 2020-11-23 00:39 我的人生不止一部戏 阅读(204) 评论(0) 推荐(0)
摘要: import jieba txt = open("D:\download\西游记.txt", "r", encoding='gb18030').read() words = jieba.lcut(txt) counts = {} for word in words: if len(word) == 阅读全文
posted @ 2020-11-22 21:14 我的人生不止一部戏 阅读(120) 评论(0) 推荐(0)
摘要: import turtle as t import time def popspace(): #单管间隔 t.penup() t.fd(5) def popline(draw): #画数码管 popspace() t.pendown() if draw else t.penup() t.fd(40) 阅读全文
posted @ 2020-10-18 22:12 我的人生不止一部戏 阅读(246) 评论(0) 推荐(0)
摘要: from tqdm import trange pi = 0 for i in trange(1000000000): if i%2 == 0: pi += 1/(2*i+1) else: pi -= 1/(2*i+1) pi = pi*4 print(pi) 理论上迭代次数越大,数就越接近π 阅读全文
posted @ 2020-10-11 09:55 我的人生不止一部戏 阅读(931) 评论(0) 推荐(0)
摘要: import turtle as t t.color("black", "red") t.begin_fill() t.pu() t.fd(-200) t.pd() t.seth(30) t.fd(300) t.seth(-90) t.fd(300) t.seth(150) t.fd(300) t. 阅读全文
posted @ 2020-09-15 17:12 我的人生不止一部戏 阅读(439) 评论(0) 推荐(0)
摘要: import turtle as tt import time tt.fillcolor('red') tt.begin_fill() for _ in range(3): tt.forward(100) if abs(tt.pos())<1: break tt.right(120) tt.righ 阅读全文
posted @ 2020-09-15 16:54 我的人生不止一部戏 阅读(343) 评论(0) 推荐(0)
摘要: import turtle as t t.fillcolor("red") #颜色填充函数 t.begin_fill() while True: t.forward(200) #画笔向前画200像素 t.right(144) #画笔方向右转144° if abs(t.pos()) < 1:#看画笔是 阅读全文
posted @ 2020-09-15 16:37 我的人生不止一部戏 阅读(529) 评论(0) 推荐(0)