12 2023 档案
摘要:url = 'https://www.so.com/' for i in range(20): response = requests.get(url) print(f"第{i+1}次访问") print(f'Response status: {response.status_code}') pri
阅读全文
摘要:from decimal import Decimal, getcontext from tqdm import tqdm # 设置精度为 getcontext().prec = 100000 # 计算圆周率 def compute_pi(): pi = Decimal(0) k = 0 with
阅读全文
摘要:import pygame import sys class Bird(object): """定义一个鸟类""" def __init__(self): """定义初始化方法""" self.birdRect = pygame.Rect(65, 50, 50, 50) # 鸟的矩形 # 定义鸟的3
阅读全文
摘要:import random import os print("08") # 介绍比赛以及程序 def print_introduce(): print("This is a badminton game simulation program") print("The program requires
阅读全文
摘要:numpy是Python中用于进行科学计算的基础模块,提供了多维数组对象ndarray以及相关的数学运算和线性代数函数。它能够快速高效地处理大量数据,并提供了丰富的数组操作和数学函数,是进行科学计算和数据分析的重要工具。numpy的主要功能有:创建和操作多维数组,如使用np.array(),np.a
阅读全文
摘要:import jieba#读取文本path = "聊斋志异.txt"file = open(path, "r", encoding="utf-8")text = file.read()file.close()#使用jieba分词words = jieba.lcut(text)#统计词语频率count
阅读全文