Some simple,useful,common python fuction and class in my work
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
data
test
.gitignore
README.md
__init__.py
_langconv.py
_zh_wiki.py
expath.py
expath_example.py
install
net.py
spider.py
sql.py
thread.py
util.py

README.md

simple package for python 2.x

Dependces: MySQLdb, python-redis, pymssql, python lxml

centos

sudo yum -y install python-redis MySQL-python python-lxml python-pip freetds-devel
sudo easy_install-2.7 setuptools-git

sudo easy_install-2.7 pymssql #or
sudo pip install pymssql

debain

sudo apt-get install python-redis python-mysqldb python-pymssql python-lxml

Clone this project, and add the upper directory to .bashrc

PYTHONPATH=$PYTHONPATH:local_dir
export PYTHONPATH

Then, source .bashrc, import package in you code like that.

import pylib

test_string = "md5 test"
md5_str = pylib.util.md5(test_string)

More examples are in test directory.

模块(Modules)

util.py: some simport function that used often, like get string md5, get the datetime now, so on.
sql.py: depend on the MySQLdb, package the cursor as a class.
thread.py: quickly start threads with a datas queue.
net.py: simple package of urllib and urllib2 to get(), post(), download_file(), proxy_get()...
spider.py: some commom function the used by website spider.
expath.py: depend on lxml.etree, use the xpath to pick content from html.