摘要: import requests from bs4 import BeautifulSoup import bs4 def getHTMLText(url): try: r = requests.get(url,timeout=30) r.raise_for_status() r.encoding = 阅读全文
posted @ 2020-12-14 19:02 hyhhuila 阅读(91) 评论(0) 推荐(0)
摘要: import requests def getHTMLText(self): try: for i in range(0,20): r = requests.get(url, timeout=30) r.raise_for_status() r.encoding = 'utf-8' return r 阅读全文
posted @ 2020-12-14 15:07 hyhhuila 阅读(210) 评论(0) 推荐(0)
摘要: import numpy as np ls1 = [10, 42, 0, -17, 30] nd1 =np.array(ls1) print(nd1) print(type(nd1)) import scipy import numpy as np from scipy import linalg 阅读全文
posted @ 2020-11-23 11:55 hyhhuila 阅读(66) 评论(0) 推荐(0)
摘要: 将体育竞技分析分解为以下几个小步骤 1、打印程序的介绍性信息式 2、获得程序运行参数:probA(A的能力值),probB(B的能力值),n(比赛场次) 3、利用球员AB的能力值,模拟n场比赛 4、输出球员AB获胜的场次及概率 (1)单人比赛: from random import random # 阅读全文
posted @ 2020-11-23 08:43 hyhhuila 阅读(564) 评论(0) 推荐(0)
摘要: import jieba txt = open("聊斋志异简写版.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) for word in words: if len(word) == 1: continue elif word 阅读全文
posted @ 2020-11-15 11:22 hyhhuila 阅读(68) 评论(0) 推荐(0)
摘要: s1=["小明","老李"] s2=["10岁","90岁"] s3=["男"] s4=["上山去砍柴","开车去东北","最爱打游戏"] for i in range(3): print("{},{},{},{}".format(s1[0],s2[0],s3[0],s4[i])) print("\ 阅读全文
posted @ 2020-10-30 21:30 hyhhuila 阅读(52) 评论(0) 推荐(0)
摘要: print("小明,10岁,男,上山去砍柴") print("小明,10岁,男,开车去东北") print("小明,10岁,男,最爱打游戏") print("\n") print("老李,90岁,男,上山去砍柴") print("老李,90岁,男,开车去东北") print("老李,90岁,男,最爱 阅读全文
posted @ 2020-10-30 21:25 hyhhuila 阅读(59) 评论(0) 推荐(0)
摘要: def kanchai(name, age, gender): print ("%s,%s岁,%s,上山去砍柴"%(name, age, gender)) def qudongbei(name, age, gender): print ("%s,%s岁,%s,开车去东北"%(name, age, g 阅读全文
posted @ 2020-10-30 21:16 hyhhuila 阅读(33) 评论(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-19 08:55 hyhhuila 阅读(198) 评论(0) 推荐(0)
摘要: import math import time scale=30 s,m,=1,2 total,s,n,t=0.0,1,1.0,1.0 print("执行开始".center(scale//2, "-")) start = time.perf_counter() for i in range(sca 阅读全文
posted @ 2020-10-11 10:04 hyhhuila 阅读(403) 评论(0) 推荐(0)