摘要: import requests for i in range (20): print("第",i+1,"次访问") r=requests.get("https://www.google.cn/") r.encoding='utf-8' print("返回状态:",r.status_code) pri 阅读全文
posted @ 2020-12-13 16:14 123_4 阅读(56) 评论(0) 推荐(0)
摘要: Numpy 定义:NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。它主要用于数组计算,包括: 一个强大的N维数组对象 ndarray 广播功能函数 整合 C/C++/Fortran 代码的工 阅读全文
posted @ 2020-11-22 19:31 123_4 阅读(91) 评论(0) 推荐(0)
摘要: 单人赛预测 from random import random #打印程序介绍信息 def printIntro(): print("这个程序模拟两个选手A和B的乒乓球比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") #获得程序运行参数 def printInputs 阅读全文
posted @ 2020-11-22 19:19 123_4 阅读(79) 评论(0) 推荐(0)
摘要: import jieba txt = open("西游记1.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for word i 阅读全文
posted @ 2020-11-14 19:32 123_4 阅读(88) 评论(0) 推荐(0)
摘要: import timeimport turtle as tt# 绘制间隔def drawGap(): tt.penup() tt.fd(5)# 绘制单段数码管def drawLine(draw): drawGap() if (draw): tt.pendown() else: tt.penup() 阅读全文
posted @ 2020-10-19 20:01 123_4 阅读(124) 评论(0) 推荐(0)
摘要: 一:方法——贝利-波尔温-普劳夫公式(BBP 公式) 二:python代码 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 阅读全文
posted @ 2020-10-10 23:41 123_4 阅读(970) 评论(0) 推荐(0)
摘要: import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.pensize(1) turtle.pencolor("red") turtle.fillcolor("white") turtle.fd(100) turtle.se 阅读全文
posted @ 2020-09-15 11:28 123_4 阅读(140) 评论(0) 推荐(0)
摘要: import turtle # 设置画布大小 # turtle.screensize(canvwidth=None, canvheight=None, bg=None) turtle.setup(500,500,200,200) # 设置初始位置 turtle.penup() turtle.left 阅读全文
posted @ 2020-09-15 11:10 123_4 阅读(156) 评论(0) 推荐(0)
摘要: import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.pensize(1) turtle.pencolor("red") turtle.fillcolor("purple") turtle.begin_fill() tur 阅读全文
posted @ 2020-09-15 10:23 123_4 阅读(136) 评论(0) 推荐(0)