摘要: from bs4 import BeautifulSoup r = ''' <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com) 33号的作业</title> </head> <body> <h1>我 阅读全文
posted @ 2020-12-14 17:38 派大星特烦 阅读(247) 评论(0) 推荐(0)
摘要: import requests for i in range(20): r=requests.get("https://www.sogou.com",timeout=30) r.raise_for_status() r.encoding='utf-8' print('状态={}'.format(r. 阅读全文
posted @ 2020-12-14 17:35 派大星特烦 阅读(62) 评论(0) 推荐(0)
摘要: import numpy as np from scipy.optimize import curve_fit #创建函数f(x) = ax + b def func(x,a,b): return a*x+b #创建干净数据 x = np.linspace(0,10,100) y = func(x, 阅读全文
posted @ 2020-11-22 22:35 派大星特烦 阅读(59) 评论(0) 推荐(0)
摘要: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from matplotlib import cm fig = plt.figure() ax = fig.gca(projection='3d') X, 阅读全文
posted @ 2020-11-22 22:25 派大星特烦 阅读(79) 评论(0) 推荐(0)
摘要: import numpy as np a = np.arange(9, dtype = np.float_).reshape(3,3) print ('第一个数组:') print (a) print ('\n') print ('第二个数组:') b = np.array([10,10,10]) 阅读全文
posted @ 2020-11-22 22:24 派大星特烦 阅读(60) 评论(0) 推荐(0)
摘要: from random import random def printInfo(): print("这个程序模拟两个选手A和B的乒乓比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") def getInputs(): a = eval(input("请输入选手A的能力值 阅读全文
posted @ 2020-11-22 20:13 派大星特烦 阅读(63) 评论(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:21 派大星特烦 阅读(97) 评论(0) 推荐(0)
摘要: import jieba excludes = {"什么","一个","我们","那里","你们","如今","说道","知道","起来","姑娘","这里","出来","他们","众人","自己", "一面","只见","怎么",&quo 阅读全文
posted @ 2020-11-15 11:03 派大星特烦 阅读(104) 评论(0) 推荐(0)
摘要: #第1种 print("小明,10岁,男,上山去砍柴") print("小明,10岁,男,开车去东北") print("小明,10岁,男,最爱打游戏") print("\n") print("老李,90岁,男,上山去砍柴") print("老李,90岁,男,开车去东北") print("老李,90岁 阅读全文
posted @ 2020-11-01 11:04 派大星特烦 阅读(56) 评论(0) 推荐(0)
摘要: from random import random from time import perf_counter DARTS = 1000 * 1000 hits = 0.0 start = perf_counter() for i in range(1,DARTS+1): x,y = random( 阅读全文
posted @ 2020-10-19 20:05 派大星特烦 阅读(60) 评论(0) 推荐(0)