搜索到与相关的文章
Python

python安装numpy和pandas的方法步骤

最近要对一系列数据做同比比较,需要用到numpy和pandas来计算,不过使用python安装numpy和pandas因为linux环境没有外网遇到了很多问题就记下来了。首要条件,python版本必须是2.7以上。linux首先安装依赖包yum-yinstallblasblas-devellapack-devellapackyum-yinstallseabornscipyyum-yinstallfreetypefreetype-devellibpnglib

系统 2019-09-27 17:49:31 2004

Python

python多进程间通信

这里使用pipe代码如下:importtimefrommultiprocessingimportProcessimportmultiprocessingclassD:@staticmethoddeftest(pipe):whileTrue:foriinrange(10):pipe.send(i)time.sleep(2)@staticmethoddeftest2(pipe):whileTrue:print('test2value:%s'%pipe.recv

系统 2019-09-27 17:49:29 2004

Python

Python3.x中自定义比较函数

在Python3.x的世界里,cmp函数没有了。那么sorted,min,max等需要比较函数作为参数的函数该如何用呢?以min函数的定义为例,有两种重载形式:单参数(一个迭代器):复制代码代码如下:min(iterable[,key=func])->value多参数(多个待比较内容):复制代码代码如下:min(a,b,c,...[,key=func])->value本文主要讨论key=func参数的使用。举例说明吧:1.自定义对象的比较我定义了一个类te

系统 2019-09-27 17:48:44 2004

Python

python os模块的使用

文章目录获取当前决定路径os.getcwd()获取路径下的所有文件名和路径名os.listdir()创建文件夹os.makedirs()删除文件夹os.remove()获取文件的绝对路径os.path.abspath("init.py")判断指定路径或者文件是否存在os.path.exists()将文件路径和文件组成一个完成的路径os.ptah.join()获取当前决定路径os.getcwd()paths=os.getcwd()print(paths)#D

系统 2019-09-27 17:48:26 2004

Python

python开头的coding设置方法

缘起:[root@CentOS7code]#pythonmulti_thread_mfw.pyFile"multi_thread_mfw.py",line138SyntaxError:Non-ASCIIcharacter'\xe5'infilemulti_thread_mfw.pyonline138,butnoencodingdeclared;seehttp://www.python.org/peps/pep-0263.htmlfordetails写完py

系统 2019-09-27 17:48:24 2004

Python

python文字转图片

fromPILimportImage,ImageFont,ImageDrawdefCreateImg(text):fontSize=30liens=text.split('\n')print(len(liens))im=Image.new("RGB",(480,len(lines)*(fontSize+5)),(255,0,0))dr=ImageDraw.Draw(im)fontPath=r"C:\Windows\Fonts\STKAITI.TTF"#fo

系统 2019-09-27 17:48:05 2004

Python

Python实现的tab文件操作类分享

类代码:#-*-coding:gbk-*-importosclassTABFILE:def__init__(self,filename,dest_file=None):self.filename=filenameifnotdest_file:self.dest_file=filenameelse:self.dest_file=dest_fileself.filehandle=Noneself.content=[]self.initflag=Falsesel

系统 2019-09-27 17:47:28 2004

Python

Python3分析处理声音数据的例子

将音频文件拷贝到程序所在目录即可。如下所示:#!/usr/bin/envpython#encoding:utf-8"""@Company:华中科技大学电气学院聚变与等离子研究所@version:V1.0@author:Victor@contact:1650996069@qq.comoryexin@hust.edu.cn2018--2020@software:PyCharm@file:VoiceDataProcessing.py@time:2018/9/81

系统 2019-09-27 17:47:00 2004

Python

Python+django实现文件上传

1、文件上传(input标签)(1)html代码(form表单用post方法提交)表格(2)jq提交表单到后台$("#submitForm").click(function(){//alert($("#SelectBus").val());addNameForm();//因为是动态加载的表单内容,所以会用函数给所用标签符name值$.ajaxSetup({async:false});$("#picture_form").ajaxSubmit({resetF

系统 2019-09-27 17:38:37 2004