搜索到与相关的文章
编程技术

heapsort

#includeusingnamespacestd;voidDownAdjust(int*a,intfirst,intlast)...{inttmp,down;tmp=a[first];for(down=first*2+1;down<=last;down=down*2+1)...{//if(downa[down+1])++down;//if(a[down]

系统 2019-08-29 22:38:51 2175

Python

利用python打印99乘法表

classPrintTable(object):'''打印乘法口诀表'''def__init__(self):print(u'开始打印9*9的乘法口诀表')self.print99()defprint99(self):foriinrange(1,10):forjinrange(1,1+i):print('%d%d=%2s'%(i,j,i*j),end='')print('\n')if__name__=='__main__':pt=PrintTable()

系统 2019-09-27 17:55:18 2174

Python

python3.6 tkinter实现屏保小程序

本文实例为大家分享了python3.6tkinter实现屏保小程序,供大家参考,具体内容如下该小程序是在闲着没事的时候,随便写的,就当打发无聊了。该程序是用python3.6写的,调用了python中的tkinter的库(*python2x与python3x的thinter有很多不同的地方,一定要特别注意!!!)fromrandomimportrandintfromtkinterimport*classRandball():def__init__(self

系统 2019-09-27 17:54:02 2174

Python

python2和python3实现在图片上加汉字

文章目录Python2在图片上加汉字代码实现Python3在图片上加汉字代码实现遇到的问题python2和python3实现在图片上加汉字,最主要的区别还是内部编码方式不一样导致的,在代码上表现为些许的差别。理解了内部编码原理也就不会遇到这些问题了,以下代码是在WIN10系统上时测好用的。Python2在图片上加汉字代码实现#-*-coding:cp936-*-importcv2importnumpyasnpfromPILimportImage,Image

系统 2019-09-27 17:53:47 2174

Python

MySQL-Python安装问题小记

安装完mysql-python后import加载模块提示以下错误,复制代码代码如下:ImportError:libmysqlclient_r.so.16:cannotopensharedobjectfile:Nosuchfileordirectory于是google之,总结一下解决方法:(1)在mysql-ython的安装目录下找到site.cfg,将#mysql_config=XXXXXXXXXXXXXXXX注释符号去掉,并填上mysql_config的

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

Python

Python+matplotlib实现填充螺旋实例

填充螺旋演示结果:实例代码:importmatplotlib.pyplotaspltimportnumpyasnptheta=np.arange(0,8*np.pi,0.1)a=1b=.2fordtinnp.arange(0,2*np.pi,np.pi/2.0):x=a*np.cos(theta+dt)*np.exp(b*theta)y=a*np.sin(theta+dt)*np.exp(b*theta)dt=dt+np.pi/4.0x2=a*np.cos

系统 2019-09-27 17:52:35 2174

Python

Python中一个for循环循环多个变量的示例

首先,熟悉一个函数zip,如下是使用help(zip)对zip的解释。Helponbuilt-infunctionzipinmodule__builtin__:zip(...)zip(seq1[,seq2[...]])->[(seq1[0],seq2[0]...),(...)]Returnalistoftuples,whereeachtuplecontainsthei-thelementfromeachoftheargumentsequences.Ther

系统 2019-09-27 17:51:25 2174

Python

python redis连接 有序集合去重的代码

pythonredis连接有序集合去重的代码如下所述:#-*-coding:utf-8-*-importredisfromconstantimportredis_ip,redis_db,redis_pw,redis_zset_namepool=redis.ConnectionPool(host=redis_ip,db=redis_db,password=redis_pw)#pool=redis.ConnectionPool(db=6,password=re

系统 2019-09-27 17:51:00 2174

Python

python对日志进行处理的实例代码

平时做数据处理基本离不了日志记录功能。每次都配置一堆挺烦人,索性封装个模块,这里记录一下,与大家共享。说明本日志模块目前只有一个方法getLogger,其他配置项通过参数传递,包括日志文件名,等级,日志文件划分方式,日志清除配置,日志格式等。logger.pyimportloggingfromloggingimporthandlers#日志级别字典__level_dict={'critical':logging.CRITICAL,'fatal':loggi

系统 2019-09-27 17:50:32 2174