摘要: (1)百度主页 import requests def gethtmltext(url): try: r=requests.get(url,timeout=30) r.raise_for_status() r.encoding='utf-8' return r.text except: return 阅读全文
posted @ 2020-12-14 00:07 二二三 阅读(79) 评论(0) 推荐(0)
摘要: Numpy: 来存储和处理大型矩阵,比Python自身的嵌套列表(nested list structure)结构要高效的多,本身是由C语言开发。这个是很基础的扩展,其余的扩展都是以此为基础。数据结构为ndarray,一般有三种方式来创建。 Pandas: 基于NumPy 的一种工具,该工具是为了解 阅读全文
posted @ 2020-11-23 01:03 二二三 阅读(100) 评论(0) 推荐(0)
摘要: from random import random def printInfo(): print("我的学号后两位是:32") def getInputs(): a = eval(input("请输入选手A的能力值(0-1): ")) b = eval(input("请输入选手B的能力值(0-1): 阅读全文
posted @ 2020-11-22 22:12 二二三 阅读(69) 评论(0) 推荐(0)
摘要: import jieba txt = open("西游记.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in 阅读全文
posted @ 2020-11-15 00:04 二二三 阅读(1139) 评论(0) 推荐(0)
摘要: 方法一: print("小明,10岁,男,上山去砍柴") print("小明,10岁,男,开车去东北") print("小明,10岁,男,最爱打游戏") print("\n") print("老李,90岁,男,上山去砍柴") print("老李,90岁,男,开车去东北") print("老李,90岁 阅读全文
posted @ 2020-10-31 18:10 二二三 阅读(90) 评论(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 19:32 二二三 阅读(76) 评论(0) 推荐(0)
摘要: def PI(n): pi=0 for k in range(n): pi += 1/pow(16,k)*(4/(8*k+1)-2/(8*k+4)-1/(8*k+5)-1/(8*k+6)) return pi import time scale = 20 print("执行开始".center(sc 阅读全文
posted @ 2020-10-11 01:31 二二三 阅读(133) 评论(0) 推荐(0)
摘要: import turtle def drawSnake(rad, angle, len, neckrad): for _ in range(len): turtle.circle(rad, angle) turtle.circle(-rad, angle) turtle.circle(rad, an 阅读全文
posted @ 2020-09-22 00:15 二二三 阅读(187) 评论(0) 推荐(0)
摘要: import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-120) turtle.pendown() turtle.pensize(6) turtle.pencolor("black") turtle.seth(-12 阅读全文
posted @ 2020-09-16 00:53 二二三 阅读(149) 评论(0) 推荐(0)
摘要: import turtle turtle.penup() turtle.fd(-100) turtle.pendown() turtle.pensize(10) turtle.pencolor("black") turtle.left(30) turtle.forward(100) turtle.r 阅读全文
posted @ 2020-09-16 00:51 二二三 阅读(145) 评论(0) 推荐(0)