摘要: rom bs4 import BeautifulSoup r = ''' <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com) 40号的作业</title> </head> <body> <h1>我的 阅读全文
posted @ 2020-12-14 17:40 小C+ 阅读(73) 评论(0) 推荐(0) 编辑
摘要: mport requests url="https://www.shanghairanking.cn/" def gethtml(url): try: r=requests.get(url) r.raise_for_status() r.encoding="utf-8" print("text内容: 阅读全文
posted @ 2020-12-14 17:21 小C+ 阅读(42) 评论(0) 推荐(0) 编辑
摘要: import requests url="https://cn.bing.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 17:14 小C+ 阅读(48) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") pl 阅读全文
posted @ 2020-11-23 08:51 小C+ 阅读(43) 评论(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 16:52 小C+ 阅读(137) 评论(0) 推荐(0) 编辑
摘要: import jieba txt = open("聊斋志异白话简写版.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for w 阅读全文
posted @ 2020-11-15 10:34 小C+ 阅读(72) 评论(0) 推荐(0) 编辑
摘要: #第1种 print("小明,10岁,男,上山去砍柴") print("小明,10岁,男,开车去东北") print("小明,10岁,男,最爱打游戏") print("\n") print("老李,90岁,男,上山去砍柴") print("老李,90岁,男,开车去东北") print("老李,90岁 阅读全文
posted @ 2020-10-29 19:30 小C+ 阅读(43) 评论(0) 推荐(0) 编辑
摘要: #CalPiv2.py 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 阅读全文
posted @ 2020-10-24 16:23 小C+ 阅读(67) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.color("blue","red") turtle.begin_fill() while True: turtle.forward(50) turtle.right(120) turtle.forward(50) turtle.left(60) if ab 阅读全文
posted @ 2020-10-23 19:29 小C+ 阅读(106) 评论(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 18:12 小C+ 阅读(68) 评论(0) 推荐(0) 编辑