Python 常用的标准库以及第三方库有哪些

Python015

Python 常用的标准库以及第三方库有哪些,第1张

我也来几个吧

standard libs:

itertools http://docs.python.org/2/library/itertools.html

functools http://docs.python.org/2/library/functools.html 学好python有必要掌握上面这两个库吧,

re 正则

subprocess http://docs.python.org/2/library/subprocess.html 调用shell命令的神器

pdb 调试

traceback 调试

pprint 漂亮的输出

logging 日志

threading和multiprocessing 多线程

urllib/urllib2/httplib http库,httplib底层一点,推荐第三方的库requests

os/sys 系统,环境相关

Queue 队列

pickle/cPickle 序列化工具

hashlib md5, sha等hash算法

cvs

json/simplejson python的json库,据so上的讨论和benchmark,simplejson的性能要高于json

timeit 计算代码运行的时间等等

cProfile python性能测量模块

glob 类似与listfile,可以用来查找文件

atexit 有一个注册函数,可用于正好在脚本退出运行前执行一些代码

dis python 反汇编,当对某条语句不理解原理时,可以用dis.dis 函数来查看代码对应的python 解释器指令等等。

3th libs:

paramiko https://github.com/paramiko/paramiko ssh python 库

selenium https://pypi.python.org/pypi/selenium 浏览器自动化测试工具selenium的python 接口

lxml http://lxml.de/ python 解析html,xml 的神器

mechanize https://pypi.python.org/pypi/mechanize/ Stateful programmatic web browsing

pycurl https://pypi.python.org/pypi/pycurl cURL library module for Python

Fabric http://docs.fabfile.org/en/1.8/

Fabric is a Python (2.5 or higher) library and command-line tool for

streamlining the use of SSH for application deployment or systems

administration tasks.

xmltodict https://github.com/martinblech/xmltodict xml 转 dict,真心好用

urllib3 和 requests: 当然其实requests就够了 Requests: HTTP for Humans

flask http://flask.pocoo.org/python web 微框架

ipdb 调试神器,同时推荐ipython!结合ipython使用

redis redis python接口

pymongo mongodbpython接口

PIL http://www.pythonware.com/products/pil/ python图像处理

mako http://www.makotemplates.org/ python模版引擎

numpy , scipy 科学计算

matplotlib 画图

scrapy 爬虫

django/tornado/web.py/web2py/uliweb/flask/twisted/bottle/cherrypy.等等 python web框架/服务器

sh 1.08 — sh v1.08 documentation 用来运行shell 模块的 极佳选择

暂时记得这么多吧,不过都是我自己常用的库 :) 。。欢迎补充

UPDATE:

A curated list of awesome Python frameworks, libraries and software.

vinta/awesome-python · GitHub

几乎所有很赞的 python 库,和框架都在这个列表里。

其他的 awesome list:

bayandin/awesome-awesomeness · GitHub

它们的主要区别是:1、python的标准库是随着pyhon安装的时候默认自带的库;2、python的第三方库,需要下载后安装到python的安装目录下。不同的第三方库安装及使用方法不同。3、它们调用方式是一样的,都需要用import语句调用。简单的说,一个是默认自带不需要下载安装的库,一个是需要下载安装的库。它们的调用方式是一样的。