随笔分类 -  python

摘要:``` import datetime import time d1=datetime.date.today() t1=time.mktime(d1.timetuple()) d2=datetime.datetime.today() t2=time.mktime(d2.timetuple()) ``` 阅读全文
posted @ 2015-11-04 23:22 过去的我 阅读(2644) 评论(0) 推荐(0) 编辑
摘要:re.match()从开头开始匹配string。 re.search()从anywhere 来匹配string。 例子: 可以加个'^'来强制search从开头开始匹配。 MULTILINE 多行模式下,match也只匹配string的开头部分,而用了'^'正则的re.search... 阅读全文
posted @ 2015-11-04 13:33 过去的我 阅读(914) 评论(0) 推荐(0) 编辑
摘要:1. 添加一个classmethod 这里要用到装饰器(Decorator)。装饰器的概念可以看这里: "http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/0013868... 阅读全文
posted @ 2015-10-25 08:26 过去的我 阅读(1059) 评论(0) 推荐(0) 编辑
摘要:delete old data in elasticsearch 0.正文。 其实很简单,就是用他的rest api 发一个delete 请求到 localhost:9200/[indices] [indices]怎么获取?可以用过插件,比如head,marvel等。但是最简单还是通过他的... 阅读全文
posted @ 2015-10-15 08:43 过去的我 阅读(381) 评论(0) 推荐(0) 编辑
摘要:在centos 上面安装特别纠结。pip install fabric ,install 成功以后 import paramiko 会报如下的错误,。。。。。。AttributeError:'module'objecthasnoattribute'HAVE_DECL_MPZ_POWM_SEC' 这个... 阅读全文
posted @ 2014-09-27 12:36 过去的我 阅读(484) 评论(0) 推荐(0) 编辑
摘要:SimpleXMLRPCServe其实里面xml的概念不是很强,主要是rpc !不用关心什么xml 。 rpc 是就是远程调用,把函数什么的放到远程服务器上,本地调用就行了。用 SimpleXMLRPCServer实现起来非常简洁。 服务器端: server = SimpleXMLRPCS... 阅读全文
posted @ 2014-09-17 15:16 过去的我 阅读(943) 评论(0) 推荐(0) 编辑
摘要:简单实现用了2个模块,smtplib 主要的三个函数login ,sendmial ,closeSMTP.login(user,password)SMTP.sendmail(from_addr,to_addrs,msg[,mail_options,rcpt_options])https://docs... 阅读全文
posted @ 2014-09-04 14:05 过去的我 阅读(444) 评论(0) 推荐(0) 编辑
摘要:1. lambdaThe lambda operator or lambda function is a way to create small anonymous functions ,i.e. functions without a name. 可以方便的创造一个函数。比如 def add(... 阅读全文
posted @ 2014-09-02 13:25 过去的我 阅读(226) 评论(0) 推荐(0) 编辑
摘要:1 install pymsql 是python的一个扩展库,编译的话需要安装上python的devel包,setuptools 。 Ubuntu : apt-get installpython-devpython-setuptools centos : yum install p... 阅读全文
posted @ 2014-08-27 22:05 过去的我 阅读(1023) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示