Skip to content

Some simple,useful,common python fuction and class in my work

Notifications You must be signed in to change notification settings

astraylinux/pylib

Repository files navigation

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.

About

Some simple,useful,common python fuction and class in my work

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published