Python
小丑戏
这个作者很懒,什么都没留下…
展开
-
#python# pip install 因网络问题无法下载安装包
提示: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) ...... 解决方式:在 pip install xxx 后面加上镜像路径(xxxx为要安装的包) # 阿里云 pip install xxxx -i http://mirrors.aliyun.com/pypi/simple/ --trust-host mirrors.aliyun.com # or 中国科技大学 pi原创 2021-09-17 09:52:18 · 719 阅读 · 0 评论 -
#Python# 绘图相关
使用matplotlib的pyplot模块 import matplotlib.pylab as plt # 绘制一条曲线 x = np.arange(0,1,0.1) y = x ** 2 # r : 红色; - :实线 plt.plot(x,y,'r-',label = 'Curve') # 坐标轴标识 plt.xlabel('x') plt.ylabel('y') # 坐标轴范...原创 2020-02-24 12:35:48 · 189 阅读 · 0 评论 -
#Python#学习笔记
python提供的函数真是多,记录下 ord(): 获取字符的整数表示 chr(): 把编码转换为对应的字符 ’xxx’.encode(‘ascii’): 用ascii码编码字符串为bytes 注意,含有中文的str不可以用ascii编码,可以用UTF-8编码为bytes b’\xe4\xb8\xad\xe6\x96\x87’.decode(‘utf-8’): 将bytes数据解码为str len...原创 2019-09-03 09:20:45 · 73 阅读 · 0 评论 -
#Python# 格式化
虽然各种语言的格式化方式都差不多,但写法上还是有些区别。在此记录下python的写法 第一种 ’分类正确数:%d, 正确率为: %f‘ % (n,rate) 常见的占位符号有 %s %d %f %x 十六进制 第二种 ’分类正确数:{0}, 正确率为: {1}‘.format(n,rate) 这里使用了format方法,n,rate依次替代占位符{0},{1} ...原创 2019-09-03 09:26:48 · 92 阅读 · 0 评论