摘要: from bs4 import BeautifulSoup import re soup=BeautifulSoup('''<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </h 阅读全文
posted @ 2020-12-14 16:46 白晨661 阅读(81) 评论(0) 推荐(0)
摘要: 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-14 16:40 白晨661 阅读(90) 评论(0) 推荐(0)
摘要: NumPy篇 numpy.around() 函数返回指定数字的四舍五入值 numpy.floor() numpy.floor() 返回小于或者等于指定表达式的最大整数,即向下取整 numpy.ceil() numpy.ceil() 返回大于或者等于指定表达式的最小整数,即向上取整 numpy.rec 阅读全文
posted @ 2020-11-21 16:21 白晨661 阅读(81) 评论(0) 推荐(0)
摘要: from random import random def printIntro(): #打印程序介绍信息 print("31号罗伟恒进行比赛分析结果:") print("这个程序模拟两个队伍A和B的某种竞技比赛") print("程序运行需要队伍A和队伍B的能力值(以0到1之间的小数表示)") d 阅读全文
posted @ 2020-11-21 14:47 白晨661 阅读(81) 评论(0) 推荐(0)
摘要: import jieba txt = open("西游记.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in 阅读全文
posted @ 2020-11-15 10:25 白晨661 阅读(146) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-11-15 10:01 白晨661 阅读(57) 评论(0) 推荐(0)
摘要: import random import time N=1000*1000 k=0 start=time.perf_counter() for i in range(N): x,y=random.random(),random.random() dist=pow(x**2+y**2,0.5) if 阅读全文
posted @ 2020-10-24 16:12 白晨661 阅读(139) 评论(0) 推荐(0)
摘要: import turtle, datetime def drawGap(): turtle.up() turtle.fd(5) def drawLine(draw): drawGap() if(draw): turtle.down() else: turtle.up() turtle.fd(40) 阅读全文
posted @ 2020-10-18 17:04 白晨661 阅读(82) 评论(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-21 19:35 白晨661 阅读(98) 评论(0) 推荐(0)
摘要: import turtle turtle.left(30) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.fo 阅读全文
posted @ 2020-09-14 21:36 白晨661 阅读(225) 评论(0) 推荐(0)