- 军军小站|张军博客
搜索到与相关的文章
编程技术

程序员必知8大排序3大查找(一)

第二篇《程序员必知8大排序3大查找(二)》《程序员必知8大排序3大查找(三)》每天都在叫嚣自己会什么技术,什么框架,可否意识到你每天都在被这些新名词、新技术所迷惑,.NET、XML等等技术固然诱人,可是如果自己的基础不扎实,就像是在云里雾里行走一样,只能看到眼前,不能看到更远的地方。这些新鲜的技术掩盖了许多底层的原理,要想真正的学习技术还是走下云端,扎扎实实的把基础知识学好,有了这些基础,要掌握那些新技术也就很容易了。要编写出优秀的代码同样要扎实的基础,如

系统 2019-08-12 09:30:03 1841

Python

Python提取文本tf、idf

"""python提取文本的tfidf特征"""importmathfromcollectionsimportCounter#1.语料库corpus=['thisisthefirstdocument','thisisthesecondseconddocument','andthethirdone','isthisthefirstdocument']#2.对语料进行分词word_list=[]foriinrange(len(corpus)):word_lis

系统 2019-09-27 17:57:10 1840

Python

python pillow模块使用方法详解

pillowPillow是PIL的一个派生分支,但如今已经发展成为比PIL本身更具活力的图像处理库。pillow可以说已经取代了PIL,将其封装成python的库(pip即可安装),且支持python2和python3,目前最新版本是3.0.0。Pillow的Github主页:https://github.com/python-pillow/PillowPillow的文档(对应版本v3.0.0):https://pillow.readthedocs.org

系统 2019-09-27 17:56:31 1840

Python

解决python super()调用多重继承函数的问题

当类间继承关系很简单时,super()的使用很简单。classA(object):def__init__(self):print('a')classB(A):def__init__(self):super(B,self).__init__()print('b')b=B()输出结果:ab当一个类继承多个类时,问题就复杂起来了,请看下例:classA(object):def__init__(self):print('a')classB(object):def_

系统 2019-09-27 17:55:42 1840

Python

python测试驱动开发实例

本文实例讲述了python测试驱动开发的方法,分享给大家供大家参考。具体方法如下:importunittestfrommainimportSampleclassSampleTest(unittest.TestCase):defsetUp(self):print"createanewSample"self._sample=Sample("b64e5843ca7db8199c405be565fa7f57")deftearDown(self):print"Des

系统 2019-09-27 17:55:39 1840

Python

python 动态添加属性和方法

python动态语言在运行时可以改变类的结构,添加属性,添加方法删除函数添加属性:就是在类的结构以外添加属性也可以修改1.添加对象属性(1)p1.age="123"#使用对象名创建(2)setattr(p1,"home","阳光小区")#使用内置方法设置和取得属性值getattr(p1,"home")#取得新增属性的值2.添加类属性(1)Preson.ID=111112#使用类名创建添加方法:3.添加对象方法importtypesdefstudy(self

系统 2019-09-27 17:55:39 1840

Python

MAC OS中多版本python管理

Mac中python多版本切换管理step1.$sudovi~/.bashrcstep2.命令行中输入aliaspython2=’/…/Versions/2.x/bin/python2.x’aliaspython3=’/…/Versions/3.x/bin/python3.x’Step3.刷新$source~/.bashrcStep4、验证在终端输入python2即代表是Python2.x版本,输入python3即代表是Python3.x版本。Mac设置默

系统 2019-09-27 17:55:04 1840

Python

安装 python virtualenv 虚拟环境

1.工具包安装pipinstallvirtualenv|sudoapt-getinstallpython-virtualenv2.创建虚拟环境#virtualenv/system_python_bin_path/your_virenv_local_pathvirtualenv-p/usr/bin/python2.7/usr_local_path#创建链接sudoln-sf/usr_local_path/bin/activatetf_activatesudo

系统 2019-09-27 17:54:23 1840

Python

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

类代码:#-*-coding:gbk-*-importConfigParser,osclassINIFILE:def__init__(self,filename):self.filename=filenameself.initflag=Falseself.cfg=Noneself.readhandle=Noneself.writehandle=NonedefInit(self):self.cfg=ConfigParser.ConfigParser()try

系统 2019-09-27 17:54:17 1840

Python

库函数tf.conv2d()卷积的python实现

话不多说,代码说话:importnumpyasnpimportmathclassConv2D(object):def__init__(self,shape,output_channels,ksize=3,stride=1,method='VALID'):self.input_shape=shapeself.output_channels=output_channelsself.input_channels=shape[-1]self.batchsize=s

系统 2019-09-27 17:54:06 1840