![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 50
Bing_Lingbing
这个作者很懒,什么都没留下…
展开
-
python科学计算和可视化案例
目录科学计算和可视化手绘效果绘制基本的三角函数带标签的坐标系带局部阴影的坐标系科学计算和可视化手绘效果from PIL import Imageimport numpy as npvec_el = np.pi/2.2vec_az = np.pi/4.depth = 10.im = Image.open('./资源/yingming.jpg').convert('L')a = np.asarray(im).astype('float')grad = np.gradient(a)grad_原创 2020-11-30 15:01:33 · 719 阅读 · 0 评论 -
Python 文件和数据格式化
Python数据格式转换1. WriteD2toCSV2. csv2html3. csv2json4. json2csv1. WriteD2toCSVfr = open("./资源/price2016.csv", "r")fw = open("./资源/pirce2016out.csv", "w")ls = []for line in fr: line = line.replace("\n", "") ls.append(line.split(","))for i in rang原创 2020-11-23 15:29:40 · 350 阅读 · 0 评论 -
Python程序设计方法论学习
目录程序设计方法论体育竞技体育竞技测试用例批量安装包程序设计方法论体育竞技from random import randomdef printIntro(): print("这个程序模拟两个选手A和B 的某种竞技比赛") print("程序运行需要A和B的能力值(0-1)")def getInputs(): a = eval(input("请输入选手A的能力值(0-1):")) b = eval(input("请输入选手B的能力值(0-1):"))原创 2020-11-13 11:27:12 · 383 阅读 · 0 评论 -
Python词频统计与杨辉三角
目录词频统计及个性化输出1. 所需库的安装2. jieba库小Demo3. CalHamlet 字符统计4. CalHamlet 字符统计 过滤5.三国演义 人物出场统计6.三国演义 人物出场统计 过滤版7.杨辉三角词频统计及个性化输出1. 所需库的安装由于正常操作安装太慢,所以使用豆瓣的镜像库进行安装pip3 install jieba -i https://pypi.douban.com/simplepip3 install wordcloud -i https://pypi.douba原创 2020-11-05 13:09:58 · 143 阅读 · 0 评论 -
Python 基础学习Chapter6
数组和列表Chapter 6 数组1.列表去重2. 基本数值统计计算3. 数据清洗4. 密码生成器Chapter 6 数组1.列表去重city = [‘上海’, “广州”, “上海”, “成都”, “上海”, “上海”, “北京”, “上海”, “广州”, “北京”, “上海”](1)以city列表为操作数据,对列表数据进行去重处理(2)打印输出去重后的列表city = ['上海', "广州", "上海", "成都", "上海", "上海", "北京", "上海", "广州", "北京", "上原创 2020-10-31 22:59:06 · 718 阅读 · 0 评论 -
Python 基础学习Chapter5
输出1000以内的前20个7的倍数for i in range(7, 20*7+1, 7): print(i)714212835424956637077849198105112119126133140冒泡排序def bubbleSort(arr): n = len(arr) for i in range(n): for j in range(0, n - i - 1): if arr[j] &原创 2020-10-20 20:10:45 · 326 阅读 · 1 评论 -
Python 基础学习Chapter4
PM2.5 二分支 多分支 嵌套分支(选择结构学习)PM = eval(input("请输入 PM 数值: "))if PM >= 75: print("空气存在污染,请小心!")else: print("空气没有污染,可以开展户外运动!")请输入 PM 数值: 25空气没有污染,可以开展户外运动!PM = eval(input("请输入PM 2.5 数值: "))if 0 <= PM < 35: print("空气优质,快去户外运动!")i原创 2020-10-20 19:55:05 · 509 阅读 · 1 评论 -
Python 基础学习Chapter3
不带刷新的进度条import timescale = 10print("开始执行".center(30, "-"))for i in range(scale + 1): a, b = '**' * i, '..' * (scale - i) c = (i / scale) * 100 print("%{:3.0f}[{}->{}]".format(c, a, b)) time.sleep(0.1)print("执行结束".center(20, "-"))原创 2020-10-20 19:53:43 · 258 阅读 · 0 评论 -
Python 基础学习Chapter2
美元与人民币转换string = input("请输入带符号的金钱数额:")# 输入金额if string[-1] == '$': # 判断币种并进行转换 # 如果为美元则截取转换后将数值乘以汇率 rmb = eval(string[0:-1]) * 6 print("转换后的为{}¥".format(rmb))elif string[-1] == '¥': my = eval(string[0:-1]) / 6 print("转换后的为{}$".fo原创 2020-10-20 19:49:36 · 317 阅读 · 0 评论 -
Python 基础学习Chapter1
圆形面积radius = 25area = radius * radius * 3.1415print(area)print("{:.2f}".format(area))1963.43751963.44字符串对话name = input("请输入姓名:")print("{}同学,学好python,前途无量!".format(name))print("{}大侠,学好python,大展拳脚!".format(name[0]))print("{}哥哥,学好python,人见人爱!".fo原创 2020-10-20 19:32:17 · 808 阅读 · 0 评论