摘要: 作业(2)请用requests库的get()函数访问如下一个网站20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度。 import requests from bs4 import BeautifulSoup def getUrlText(url): 阅读全文
posted @ 2020-12-14 00:13 大胖子zz 阅读(93) 评论(0) 推荐(0)
摘要: 1、基本函数用法 Numpy: 基础的数学计算模块,来存储和处理大型矩阵,比Python自身的嵌套列表(nested list structure)结构要高效的多,本身是由C语言开发。这个是很基础的扩展,其余的扩展都是以此为基础。数据结构为ndarray,一般有三种方式来创建。 Scipy: 方便、 阅读全文
posted @ 2020-11-23 00:52 大胖子zz 阅读(66) 评论(0) 推荐(0)
摘要: from random import random def printInfo(): print("我的学号后两位是:22") def getInputs(): a = eval(input("请输入选手A的能力值(0-1): ")) b = eval(input("请输入选手B的能力值(0-1): 阅读全文
posted @ 2020-11-22 19:09 大胖子zz 阅读(47) 评论(0) 推荐(0)
摘要: import jieba txt = open("西游记.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in 阅读全文
posted @ 2020-11-15 11:42 大胖子zz 阅读(506) 评论(0) 推荐(0)
摘要: class person: def kanchai(): print("小明,10岁,男,上山去砍柴") def kaiche(): print("小明,10岁,男,开车去东北") def dayouxi(): print("小明,10岁,男,最爱打游戏") no1 = person.kanchai 阅读全文
posted @ 2020-11-01 22:27 大胖子zz 阅读(111) 评论(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 23:46 大胖子zz 阅读(149) 评论(0) 推荐(0)
摘要: import turtle for i in range(4): turtle.pencolor("red") turtle.pensize(10) turtle.penup() turtle.goto(0,-50*(i+1)) turtle.pendown() turtle.circle(50*( 阅读全文
posted @ 2020-10-12 20:00 大胖子zz 阅读(123) 评论(0) 推荐(0)
摘要: import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.ri 阅读全文
posted @ 2020-10-12 19:11 大胖子zz 阅读(265) 评论(0) 推荐(0)
摘要: import math import time scale=10 print("执行开始") t=time.process_time() for i in range(scale+1): a,b='**'*i,'..'*(scale-i) c=(i/scale)*100 π=4*(4*math.at 阅读全文
posted @ 2020-10-11 11:53 大胖子zz 阅读(59) 评论(0) 推荐(0)
摘要: import turtle turtle.pensize(10) # 绘制第一道彩虹 turtle.pencolor("red") turtle.left(90) turtle.circle(10,180) # 绘制第二道彩虹 turtle.pencolor("orange") turtle.lef 阅读全文
posted @ 2020-09-21 20:03 大胖子zz 阅读(36) 评论(0) 推荐(0)