搜索到与相关的文章
Python

【OpenCV】opencv-python 版使用要点

BacktoOpenCVIndeximage#tocreateanewimageblank_image=np.zeros((height,width,3),np.uint8)#imagesize##forgrayimagerows,cols=img.shapeh,w=img.shape##forcolorimagerows,cols,channels=img.shapeh,w,c=img.shapeAPIs有些C++中的基础数据结构,比如Point,Poi

系统 2019-09-27 17:55:30 2316

Python

Python获取Linux系统下的本机IP地址代码分享

有时候使用到获取本机IP,就采用以下方式进行。复制代码代码如下:#!/usr/bin/pythonimportsocketimportstructimportfcntldefgetip(ethname):s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)returnsocket.inet_ntoa(fcntl.ioctl(s.fileno(),0X8915,struct.pack(‘256s',ethname

系统 2019-09-27 17:54:44 2316

Python

Python使用百度API上传文件到百度网盘代码分享

关于如何获取access_token这个可以自己查百度开放的OAuth2.0的API。这里不做介绍。第三方Python库poster复制代码代码如下:#coding:UTF-8importurllibimporturllib2__author__='Administrator'fromposter.encodeimportmultipart_encodefromposter.streaminghttpimportregister_openersregist

系统 2019-09-27 17:54:41 2316

Python

Python-1-Day

C=float(input("EnteradegreeinCelsius:"))F=(9/5)*C+32print("{0}Celsiusis{1}Fahrenheit".format(C,F))EnteradegreeinCelsius:4343.0Celsiusis109.4FahrenheitimportmathR,H=eval(input("Entertheradiusandlengthofacylinder:"))area=R*R*math.pi

系统 2019-09-27 17:53:26 2316

Python

python数据可视化pyecharts工具安装问题

如果pipinstallpyecharts安装不成功,请直接检查你的python版本。如果是python2.7,安装的pyecharts版本只能是V0.5.x,如果是python3,那就可以安装V0.5.x和V1.0.0及以上的。在https://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learnpython扩展网站上没有找到pyecharts,所以只能去gihub上看看了。下图是在github查阅pyecha

系统 2019-09-27 17:53:17 2316

Python

Python 中運算子 + 與 * 的 Overload 方法重載功能

字串String原本不能像數值一樣有加減乘除運算,但有例外。例如:>>>'Good'+'Morning''GoodMorning'運算子+可將2個字串,串接起來。運算子+有字串Concat功能。同樣,運算子*有迭代Iterator的功能,例如:>>>'Good'*3'GoodGoodGood'這寫法讓Python的程式更簡潔易讀。例如:forkinrange(1,6):print(''*(6-k)+'A'*2*k)這樣簡潔幾行程式即能將此圖形畫出,不是很美

系统 2019-09-27 17:52:44 2316

Python

python生成器,可迭代对象,迭代器区别和联系

生成器,可迭代对象,迭代器之间究竟是什么关系?用一幅图来概括:1.生成器定义生成器方式一://区别于列表生成式gen=[x*xforxinrange(5)]gen=(x*xforxinrange(5))print(gen)//Out:at0x00000258DC5CD8E0>方式二:deffib():prev,curr=0,1whileTrue:yieldcurrprev,curr=curr,curr+prevf=fib()print(f)//Out:定义

系统 2019-09-27 17:52:19 2316

Python

Python编写百度贴吧的简单爬虫

操作:输入带分页的地址,去掉最后面的数字,设置一下起始页数和终点页数功能:下载对应页码的所有页面并储存为HTML文件,以当前时间命名代码:#-*-coding:utf-8-*-#----------------------------#程序:百度贴吧的小爬虫#日期:2015/03/28#语言:Python2.7#操作:输入带分页的地址,去掉最后面的数字,设置一下起始页数和终点页数#功能:下载对应页码的所有页面并储存为HTML文件,以当前时间命名#-----

系统 2019-09-27 17:51:10 2316

Python

计算机视觉OpenCV之人脸识别的示例(Python)

计算机视觉之人脸识别看起来很高大上,但是用OpenCV解决很方便,OpenCV真的太强大了。。直接上代码:#!/usr/bin/envpython3importcv2image=cv2.imread("demo.jpg")gray_img=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)classifier=cv2.CascadeClassifier()classifier.load(r"C:\ProgramFiles\Open

系统 2019-09-27 17:50:45 2316