lannn_l

2020年12月13日

爬中国大学排名网站内容

摘要: import csv import os import requests from bs4 import BeautifulSoup allUniv = [] def getHTMLText(url): try: r = requests.get(url, timeout=30) r.raise_f 阅读全文

posted @ 2020-12-13 23:44 lannn_l 阅读(81) 评论(0) 推荐(0) 编辑

这是一个简单的html页面,请保持为字符串,完成后面的计算要求。

摘要: from bs4 import BeautifulSoup import re soup=BeautifulSoup('''<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </h 阅读全文

posted @ 2020-12-13 22:49 lannn_l 阅读(442) 评论(0) 推荐(0) 编辑

请用requests库的get()函数访问如下一个网站20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度。

摘要: import requests url="https://www.baidu.com/" def gethtml(url): try: r=requests.get(url) r.raise_for_status() r.encoding="utf-8" print("text内容:",r.text 阅读全文

posted @ 2020-12-13 22:11 lannn_l 阅读(137) 评论(0) 推荐(0) 编辑

2020年11月23日

读书报告

摘要: 1、基本函数用法 Numpy: 基础的数学计算模块,来存储和处理大型矩阵,比Python自身的嵌套列表(nested list structure)结构要高效的多,本身是由C语言开发。这个是很基础的扩展,其余的扩展都是以此为基础。数据结构为ndarray,一般有三种方式来创建。 Scipy: 方便、 阅读全文

posted @ 2020-11-23 00:26 lannn_l 阅读(71) 评论(0) 推荐(0) 编辑

比赛模拟

摘要: 一、采用乒乓球比赛规则(学号尾号为0,1,2,3同学必做及格题)。‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬ ‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬ 阅读全文

posted @ 2020-11-23 00:24 lannn_l 阅读(66) 评论(0) 推荐(0) 编辑

2020年11月15日

jieba

摘要: import jieba txt = open("西游记.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in 阅读全文

posted @ 2020-11-15 00:11 lannn_l 阅读(90) 评论(0) 推荐(0) 编辑

2020年10月30日

1

摘要: 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 22:25 lannn_l 阅读(36) 评论(0) 推荐(0) 编辑

2020年10月18日

7段数码管绘制

摘要: import turtle as t import time def pen(): t.up() t.fd(6) t.down() def drawline(draw): #绘制单段数码管 pen() t.pendown() if draw else t.penup() # draw 为真则执行 p 阅读全文

posted @ 2020-10-18 20:55 lannn_l 阅读(63) 评论(0) 推荐(0) 编辑

2020年10月11日

用python计算圆周率PI

摘要: 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 00:16 lannn_l 阅读(105) 评论(0) 推荐(0) 编辑

2020年9月21日

太阳花

摘要: import turtle as t import time t.color("red", "yellow") t.speed(10) t.begin_fill() for _ in range(50): t.forward(200) t.left(170) end_fill() time.slee 阅读全文

posted @ 2020-09-21 17:07 lannn_l 阅读(52) 评论(0) 推荐(0) 编辑

导航