python

Elastic Search初探

June 23, 2017 Database, Python No comments , ,

研究了下ES,写了一个python版的关于ES的增删改查代码:

from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch([{'host':'192.168.2.178','po[......]

Read more

python操作MySQL笔记

June 17, 2017 Python No comments , ,

http://www.cnblogs.com/fnng/p/3565912.html

tip1: 安装MySQLdb模块
tip2: 建立连接conn
tip3: cur=conn.cursor()
tip4: cur.execute("SQL语句")
tip5: SQL语句插入时,个数要和列数相[......]

Read more

pymongo 存入当前时间ISODate格式到mongo

June 15, 2017 Python No comments , , ,

import datetime
dateStr = datetime.datetime.now().strft("%Y-%m-%dT%H:%M:%S.%fZ")
dateISODate = datetime.datetime.strptime(dateStr, "%Y-%m-%dT%H:%M:%S.[......]

Read more

python 打印文件夹内所有文件的内容并存放到新文件中

June 5, 2017 Python No comments , ,

由于公司软件申请专利所需,需要将源代码全都写进一个文档中,一个一个手动复制粘贴太麻烦,于是就写了一个脚本自动生成,感受到python数据处理的伟大之处。

import os.path

# 项目目录路径
dir = 'C:\Users\dell\Desktop\<your dir>'[......]

Read more

python 使用Celery编写异步任务

June 5, 2017 Python No comments , , , , , , ,

Celery(芹菜)是使用python编写的任务队列工具。一个中间人会向Celery发送消息,通知它执行任务。这个中间人(Broker经纪人)被称为消息队列(Message Queue)

命令:
pip install Celery

pip install Flask-Celery-Helper[......]

Read more

设计模式 note

March 27, 2017 IT No comments , ,

terminology :

UML: Unified Modeling Language
class: the term used for kind of object
object: instance of class that can be associated with each other[......]

Read more