当前位置:  开发笔记 > 编程语言 > 正文

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

回复内容:只介绍我用过觉得有强烈推荐欲望的几个=====================标准库*http://docs.python.org/library/argparse.html写命令行脚本必备,可惜是2.7才添加的,得看具体环境了…*http://docs.python.org/librar

回复内容:

只介绍我用过觉得有强烈推荐欲望的几个

=====================标准库
* docs.python.org/library
写命令行脚本必备,可惜是2.7才添加的,得看具体环境了…

* docs.python.org/library
解析HTML DOM树,偶尔搞搞命令行自动表单提交用得上。感觉不好用但是毕竟是官方库

=====================第三方库

* pypi.python.org/pypi/sh
简直是系统管理神器,谁用谁知道

* pypi.python.org/pypi/su
轻量的SOAP客户端,如果贵厂内部有用SOAP接口,那这个几乎是必须了

* pypi.python.org/pypi/re
这个HTTP lib的名字叫Python HTTP for Human。用过urllib、urllib2、httplib的人,你懂的

* pypi.python.org/pypi/pe
* pypi.python.org/pypi/Ma
前者是静态博客生成器(写markdown文本,然后自动转换成html静态文件),后者是文档生成器(以前拿这个做wiki用)

* pypi.python.org/pypi/pe
检查Python脚本是否符合PEP8的style guide

* pypi.python.org/pypi/Py
语法高亮的lib,很多ruby项目用的都是这个python lib来做语法高亮的

其他想到了再补充吧 我也来几个吧
standard libs:
  • itertools docs.python.org/2/libra
  • functools docs.python.org/2/libra 学好python有必要掌握上面这两个库吧,
  • re 正则
  • subprocess docs.python.org/2/libra 调用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 github.com/paramiko/par ssh python 库
  • selenium pypi.python.org/pypi/se 浏览器自动化测试工具selenium的python 接口
  • lxml lxml.de/ python 解析html,xml 的神器
  • mechanize pypi.python.org/pypi/me Stateful programmatic web browsing
  • pycurl pypi.python.org/pypi/py cURL library module for Python
  • Fabric 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 github.com/martinblech/ xml 转 dict,真心好用
  • urllib3 和 requests: 当然其实requests就够了 Requests: HTTP for Humans
  • flask flask.pocoo.org/python web 微框架
  • ipdb 调试神器,同时推荐ipython!结合ipython使用
  • redis redis python接口
  • pymongo mongodbpython接口
  • PIL pythonware.com/products python图像处理
  • mako 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 原生:
系统调用的subprocess
多线程的multiprocessing

第三方:
系统管理推荐fabric和salt
WEB框架推荐flask和tornado
ORM推荐SQLAlchemy Python资源大全 去这个地方看看,Python常用模块基本都包括啦,而且还有很多学校资料 功能型的都是各取所需 就说些好用的吧

Tornado: 和其他Python框架的架构可谓大相径庭,Request的处理方式也很舒服,特别适合REST,谁用谁知道

Mako: 个人认为是最好的Template,简单 性能好

SQLAlchemy: 快一统ORM了吧

Quixote:其实还是蛮好用的

pyQuery: 用jQuery的语法写爬虫 略爽

gevent。。。。。 推荐两个 BeautifulSoup 和 IMage
20 Python libraries you can't live without

By Yasoob •
wordpress.com • July 30, 2013

Hi there fellas. Today i am going to list 20 python libraries which have been a part of my toolbelt and should be a part of yours as well. So here they are:

1.Requests. The most famous http library written by kenneth reitz. It’s a must have for every python developer.

2.Scrapy. If you are involved in webscraping then this is a must have library for you. After using this library you won’t use any other.

3.wxPython. A gui toolkit for python. I have primarily used it in place of tkinter. You will really love it.

4.Pillow. A friendly fork of PIL (Python Imaging Library). It is more user friendly than PIL and is a must have for anyone who works with images.

5.SQLAlchemy. A database library. Many love it and many hate it. The choice is yours.

6.BeautifulSoup. I know it’s slow but this xml and html parsing library is very useful for beginners.

7.Twisted. The most important tool for any network application developer. It has a very beautiful api and is used by a lot of famous python developers.

8.NumPy. How can we leave this very important library ? It provides some advance math functionalities to python.

9.SciPy. When we talk about NumPy then we have to talk about scipy. It is a library of algorithms and mathematical tools for python and has caused many scientists to switch from ruby to python.

10.matplotlib. A numerical plotting library. It is very useful for any data scientist or any data analyzer.

11.Pygame. Which developer does not like to play games and develop them ? This library will help you achieve your goal of 2d game development.

12.Pyglet. A 3d animation and game creation engine. This is the engine in which the famous python port of minecraft was made

13.pyQT. A GUI toolkit for python. It is my second choice after wxpython for developing GUI’s for my python scripts.

14.pyGtk. Another python GUI library. It is the same library in which the famous Bittorrent client is created.

15.Scapy. A packet sniffer and analyzer for python made in python.

16.pywin32. A python library which provides some useful methods and classes for interacting with windows.

17.nltk. Natural Language Toolkit – I realize most people won’t be using this one, but it’s generic enough. It is a very useful library if you want to manipulate strings. But it’s capacity is beyond that. Do check it out.

18.nose. A testing framework for python. It is used by millions of python developers. It is a must have if you do test driven development.

19.SymPy. SymPy can do algebraic evaluation, differentiation, expansion, complex numbers, etc. It is contained in a pure Python distribution.

20.IPython. I just can’t stress enough how useful this tool is. It is a python prompt on steroids. It has completion, history, shell capabilities, and a lot more. Make sure that you take a look at it.

freepythontips.wordpress.com requests 好用的让人想哭 一个memo: github.com/fengsp/easy-
或者直接: easy-python.readthedocs.org 我也来说两个:
操作系统相关的os库
python程序本身相关的sys库
配置文件解析的ConfigParser库
redis python客户端pyredis
另外还有itertool,subprocess等

web框架:web.py flask django
推荐阅读
mobiledu2402851377
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有