- 博客(21)
- 资源 (8)
- 收藏
- 关注
原创 词云 多区域绘图
import numpy as npimport matplotlib.pyplot as pltdef f(t): return np.exp(-t)*np.cos(2*np.pi*t)a=np.arange(0,5,0.02)plt.subplot(322)plt.plot(a,f(a))plt.subplot(323)plt.plot(a,np.cos(2*np.pi*a),'-.',color='r')plt.subplot(324)plt.plot(a...
2022-01-06 20:36:31
126
原创 定义绘制0-9数字函数
def drawDigit(i): #画第1线段: drawLine(True) if i in [2,3,4,5,6,8,9] else drawLine(False) drawLine(True) if i in [0,1,3,4,5,6,7,8,9] else drawLine(False) drawLine(True) if i in [0,2,3,5,6,8,9] else drawLine(False) drawLine(True) if i in [0...
2022-01-06 20:35:38
324
原创 定义主函数main()
def main(): t.setup(1000,350) t.pensize(8) t.penup() t.fd(-400) drawDate(time.strftime('%Y%m%d')) t.hideturtle() t.done()
2022-01-06 20:34:55
505
原创 定义绘制线段函数
def drawLine(draw): t.pendown() if draw else t.penup() t.pencolor(r.random(),r.random(),r.random()) t.fd(80) t.right(90)
2022-01-06 20:34:32
334
原创 12.24 python笔记
12.2427.第三方库(1) jieba库:jieba. lcut(s) :分割中文词(2) beauti fulsoup4库:安装: pip install bs4/beautifulsoup4常用导入方法:导入库:from bs4 import Beautiful Soup创建对象:soup=BeautifulSoup (文本/网页内容,’ html. parser' )输出网页代码: print (soup. prettify())(3) reauests库,安装:pi
2021-12-24 10:18:06
71
原创 TangentCirclesDraw
import turtleturtle.pensize(5)turtle.color('blue')turtle.circle(60)turtle.color('brown')turtle.circle(-60)turtle.color('red')turtle.circle(100,120)turtle.color('green')turtle.circle(100,120)turtle.color('yellow')turtle.circle(100,120)
2021-12-16 01:30:40
305
原创 square
#海伦公式:S=√p(p-a)(p-b)(p-c)。公式中a,b,c分别为三角形三边长,p为半周长,S为三角形的面积。# 首先定义3个参数,输入a=float(input('please input a:'))b=float(input('please input b:'))c=float(input('please input c:'))#判断输入的数值可以组成三角行if a<=0 or b<=0 or c<=0: print('三角形的三边必须是大于0的数'...
2021-12-16 01:29:29
268
原创 LiuBianXing
from turtle import *pensize(5)pencolor('green')for i in range(1,7): fd(100) left(60)
2021-12-16 01:28:19
48
原创 求根公式~
#gen.py"(求一元二次函数ax**2+bx+c=0的根)"a=float(input('输入 a:'))b=float(input('输入 b:'))c=float(input('输入 c:'))if a != 0: delta = b**2-4*a*cif delta < 0: print("无根")elif delta == 0: m = -b/(2*a) print("x1=x2=",m)else: x1= ((b+(b**2...
2021-12-16 01:27:48
1216
原创 FiveStar
from turtle import *pensize(5)pencolor('green')fillcolor('red')begin_fill()while True: fd(200) right(144) if abs(pos()) < 1: breakend_fill()
2021-12-16 01:27:15
765
原创 DrawTangertCircle
#DrawTangentCircles.pyimport turtleturtle.pensize(5)turtle.pencolor('blue')turtle.circle (10)turtle.circle(40)turtle.circle(80)turtle.circle(160)
2021-12-16 01:26:43
582
原创 数字列出~
# coding: utf-8# In[4]:s1=['a','b']# In[5]:s2=['c','d']# In[6]:zip(s1,s2)# In[7]:tuple(zip(s1,s2))# In[8]:dict(zip(s1,s2))# In[9]:list(zip(s1,s2))# In[12]:for i in range(10): for j in range(1,i+1): print...
2021-12-16 01:26:05
128
原创 99乘法表
#99for i in range(1,10): for j in range(1,i+1): print('{}*{}={}'.format(j,i,j*i),end='\t') print('\n')
2021-12-16 01:24:54
44
原创 12.10 python笔记
24.文件 1.文件类型 文本文件:由单一特定编码(如UTF_8)组成的文件,如.txt/.py/.html等 二进制文件:没有统一字符编码,直接由此比特0和1组成的文件,如.ping/.exe/.avi等,用记事本打开形成乱码. 2.文件的打开与关闭 打开:变量名=open('文件路径和文件名'.'rt/rb/x/w/a/+') t:文本文件打开 ...
2021-12-16 01:19:08
61
原创 12.3 python笔记
23.词云库 (1)安装:pip install wordcloud (2)常规方法: 配置对象参数:w=wordcloud.WordCloud(width,height,min_font_size,max_font_size,font_step,font_path,max_words,background_color,mask) 加载词云文本:w.generate(‘文本内容’) 输出词云文本:w....
2021-12-16 01:18:30
287
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人