码迷,mamicode.com
首页 >  
搜索关键字:def    ( 28626个结果
hdu 4864
基本思想是贪心。对于价值c=500*xi+2*yi,yi最大影响100*2 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 10 using namespace std;11 12 #def...
分类:其他好文   时间:2014-07-23 15:42:49    阅读次数:218
python描述符descriptor(二)
python内置的描述符python有些内置的描述符对象,property、staticmethod、classmethod,python实现如下:class Property(object): def __init__(self,getf,setf,delf,doc): sel...
分类:编程语言   时间:2014-07-22 23:21:47    阅读次数:335
平时的笔记01
# -*- coding: cp936 -*-from PyQt4 import QtGui,QtCoreimport sysclass MianWindow(QtGui.QMainWindow): def __init__(self,parent=None): QtGui.QM...
分类:其他好文   时间:2014-07-22 22:36:13    阅读次数:219
AMovableLabel例子
#!/us/bin/envpythonfromPyQt4importQtCore,QtGuiclassAMovableLabel(QtGui.QLabel):def__init__(self,parent=None):super(AMovableLabel,self).__init__(parent...
分类:其他好文   时间:2014-07-22 22:35:35    阅读次数:184
mongodb 实现关系型数据库中查询某一列 的效果
最近在tornado\mongodb\ansible mongodb中有个find()方法很牛逼,可以将集合中所有的表都传出来,一开始我这么写 class Module_actionHandler(tornado.web.RequestHandler): def get(self, *args, **kwargs): coll = self.applic...
分类:数据库   时间:2014-07-22 17:52:41    阅读次数:291
python 正则表达式判断邮箱格式是否正确
import re def validateEmail(email):     if len(email) > 7:         if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", email) != None:             return 1     r...
分类:编程语言   时间:2014-07-22 17:40:41    阅读次数:881
python生成带参数二维码
#coding:utf8import urllib2import urllibimport jsonimport stringimport randomclass WebChat(object): def __init__(self, appid=None, secret=None, code...
分类:编程语言   时间:2014-07-22 00:25:36    阅读次数:276
python threading queue
import queue,threading l=threading.Lock()class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) global...
分类:编程语言   时间:2014-07-22 00:20:34    阅读次数:189
Mac OS X代码量统计程序(Python版)
方便统计各种平台项目的代码量,主要用到了find指令来进行处理的详情点击打开链接。 源代码如下: # -*- coding: utf-8 -*- ''' Created on Jul 18, 2014 @author: Jayhomzhou @note: 计算注释以及代码的总行数(即代码量) ''' import subprocess def countCodes(codePa...
分类:编程语言   时间:2014-07-21 16:38:02    阅读次数:352
python3 网址路径中带中文的处理办法
由于python目前不能直接处理中文路径,必须要转化一下,如下例子是下载图片(名字为中文的): def getInfo(self,imageurl): response = urllib.request.urlopen(imageurl).read().decode('utf-8')# with o...
分类:编程语言   时间:2014-07-21 08:09:58    阅读次数:210
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!