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

Python \u5e38\u7528\u7684\u6807\u51c6\u5e93\u4ee5\u53ca\u7b2c\u4e09\u65b9\u5e93\u6709\u54ea\u4e9b

\u6807\u51c6\u5e93Python\u62e5\u6709\u4e00\u4e2a\u5f3a\u5927\u7684\u6807\u51c6\u5e93\u3002Python\u8bed\u8a00\u7684\u6838\u5fc3\u53ea\u5305\u542b\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u5b57\u5178\u3001\u6587\u4ef6\u7b49\u5e38\u89c1\u7c7b\u578b\u548c\u51fd\u6570\uff0c\u800c\u7531Python\u6807\u51c6\u5e93\u63d0\u4f9b\u4e86\u7cfb\u7edf\u7ba1\u7406\u3001\u7f51\u7edc\u901a\u4fe1\u3001\u6587\u672c\u5904\u7406\u3001\u6570\u636e\u5e93\u63a5\u53e3\u3001\u56fe\u5f62\u7cfb\u7edf\u3001XML\u5904\u7406\u7b49\u989d\u5916\u7684\u529f\u80fd\u3002Python\u6807\u51c6\u5e93\u7684\u4e3b\u8981\u529f\u80fd\u6709\uff1a

\u63a8\u83505\u4e2a\u5e38\u7528\u7684Python\u6807\u51c6\u5e93\uff1a
1\u3001os\uff1a\u63d0\u4f9b\u4e86\u4e0d\u5c11\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u76f8\u5173\u8054\u7684\u51fd\u6570\u5e93
os\u5305\u662fPython\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u7684\u63a5\u53e3\u3002\u6211\u4eec\u53ef\u4ee5\u7528os\u5305\u6765\u5b9e\u73b0\u64cd\u4f5c\u7cfb\u7edf\u7684\u8bb8\u591a\u529f\u80fd\uff0c\u6bd4\u5982\u7ba1\u7406\u7cfb\u7edf\u8fdb\u7a0b\uff0c\u6539\u53d8\u5f53\u524d\u8def\u5f84\uff0c\u6539\u53d8\u6587\u4ef6\u6743\u9650\u7b49\u3002\u4f46\u8981\u6ce8\u610f\uff0cos\u5305\u662f\u5efa\u7acb\u5728\u64cd\u4f5c\u7cfb\u7edf\u7684\u5e73\u53f0\u4e0a\u7684\uff0c\u8bb8\u591a\u529f\u80fd\u5728Windows\u7cfb\u7edf\u4e0a\u662f\u65e0\u6cd5\u5b9e\u73b0\u7684\u3002\u53e6\u5916\uff0c\u5728\u4f7f\u7528os\u5305\u4e2d\uff0c\u8981\u6ce8\u610f\u5176\u4e2d\u7684\u6709\u4e9b\u529f\u80fd\u5df2\u7ecf\u88ab\u5176\u4ed6\u7684\u5305\u53d6\u4ee3\u3002
\u6211\u4eec\u901a\u8fc7\u6587\u4ef6\u7cfb\u7edf\u6765\u7ba1\u7406\u78c1\u76d8\u4e0a\u50a8\u5b58\u7684\u6587\u4ef6\u3002\u67e5\u627e\u3001\u5220\u9664\u3001\u590d\u5236\u6587\u4ef6\u4ee5\u53ca\u5217\u51fa\u6587\u4ef6\u5217\u8868\u7b49\u90fd\u662f\u5e38\u89c1\u7684\u6587\u4ef6\u64cd\u4f5c\u3002\u8fd9\u4e9b\u529f\u80fd\u901a\u5e38\u53ef\u4ee5\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u770b\u5230\uff0c\u4f46\u73b0\u5728\u53ef\u4ee5\u901a\u8fc7Python\u6807\u51c6\u5e93\u4e2d\u7684glob\u5305\u3001shutil\u5305\u3001os.path\u5305\u4ee5\u53caos\u5305\u7684\u4e00\u4e9b\u51fd\u6570\u7b49\uff0c\u5728Python\u5185\u90e8\u5b9e\u73b0\u3002
2\u3001sys\uff1a\u901a\u5e38\u7528\u4e8e\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e93
sys\u5305\u88ab\u7528\u4e8e\u7ba1\u7406Python\u81ea\u8eab\u7684\u8fd0\u884c\u73af\u5883\u3002Python\u662f\u4e00\u4e2a\u89e3\u91ca\u5668\uff0c\u4e5f\u662f\u4e00\u4e2a\u8fd0\u884c\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684\u7a0b\u5e8f\u3002\u6211\u4eec\u53ef\u4ee5\u7528sys\u5305\u6765\u63a7\u5236\u8fd9\u4e00\u7a0b\u5e8f\u8fd0\u884c\u7684\u8bb8\u591a\u53c2\u6570\uff0c\u6bd4\u5982\u8bf4Python\u8fd0\u884c\u6240\u80fd\u5360\u636e\u7684\u5185\u5b58\u548cCPU\uff0cPython\u6240\u8981\u626b\u63cf\u7684\u8def\u5f84\u7b49\u3002\u53e6\u4e00\u4e2a\u91cd\u8981\u529f\u80fd\u662f\u548cPython\u81ea\u5df1\u7684\u547d\u4ee4\u884c\u4e92\u52a8\uff0c\u4ece\u547d\u4ee4\u884c\u8bfb\u53d6\u547d\u4ee4\u548c\u53c2\u6570\u3002
3\u3001random\uff1a\u7528\u4e8e\u751f\u6210\u968f\u673a\u6570\u7684\u5e93
Python\u6807\u51c6\u5e93\u4e2d\u7684random\u51fd\u6570\uff0c\u53ef\u4ee5\u751f\u6210\u968f\u673a\u6d6e\u70b9\u6570\u3001\u6574\u6570\u3001\u5b57\u7b26\u4e32\uff0c\u751a\u81f3\u5e2e\u52a9\u4f60\u968f\u673a\u9009\u62e9\u5217\u8868\u5e8f\u5217\u4e2d\u7684\u4e00\u4e2a\u5143\u7d20\uff0c\u6253\u4e71\u4e00\u7ec4\u6570\u636e\u7b49\u3002
4\u3001math\uff1a\u63d0\u4f9b\u4e86\u6570\u5b66\u5e38\u6570\u548c\u6570\u5b66\u51fd\u6570
\u6807\u51c6\u5e93\u4e2d\uff0cPython\u5b9a\u4e49\u4e86\u4e00\u4e9b\u65b0\u7684\u6570\u5b57\u7c7b\u578b\uff0c\u4ee5\u5f25\u8865\u4e4b\u524d\u7684\u6570\u5b57\u7c7b\u578b\u53ef\u80fd\u7684\u4e0d\u8db3\u3002\u6807\u51c6\u5e93\u8fd8\u5305\u542b\u4e86random\u5305\uff0c\u7528\u4e8e\u5904\u7406\u968f\u673a\u6570\u76f8\u5173\u7684\u529f\u80fd\u3002math\u5305\u8865\u5145\u4e86\u4e00\u4e9b\u91cd\u8981\u7684\u6570\u5b66\u5e38\u6570\u548c\u6570\u5b66\u51fd\u6570\uff0c\u6bd4\u5982pi\u3001\u4e09\u89d2\u51fd\u6570\u7b49\u7b49\u3002
5\u3001datetime\uff1a\u65e5\u671f\u548c\u65f6\u95f4\u7684\u64cd\u4f5c\u5e93
\u65e5\u671f\u548c\u65f6\u95f4\u7684\u7ba1\u7406\u5e76\u4e0d\u590d\u6742\uff0c\u4f46\u5bb9\u6613\u72af\u9519\u3002Python\u7684\u6807\u51c6\u5e93\u4e2d\u5bf9\u65e5\u671f\u548c\u65f6\u95f4\u7684\u7ba1\u7406\u9887\u4e3a\u5b8c\u5584\uff0c\u4f60\u4e0d\u4ec5\u53ef\u4ee5\u8fdb\u884c\u65e5\u671f\u65f6\u95f4\u7684\u67e5\u8be2\u548c\u53d8\u6362\uff0c\u8fd8\u53ef\u4ee5\u5bf9\u65e5\u671f\u65f6\u95f4\u8fdb\u884c\u8fd0\u7b97\u3002\u901a\u8fc7\u8fd9\u4e9b\u6807\u51c6\u5e93\uff0c\u8fd8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u63a7\u5236\u65e5\u671f\u65f6\u95f4\u8f93\u51fa\u7684\u6587\u672c\u683c\u5f0f

Python常用库大全,看看有没有你需要的。
环境管理
管理 Python 版本和环境的工具
p – 非常简单的交互式 python 版本管理工具。
pyenv – 简单的 Python 版本管理工具。
Vex – 可以在虚拟环境中执行命令。
virtualenv – 创建独立 Python 环境的工具。
virtualenvwrapper- virtualenv 的一组扩展。
包管理
管理包和依赖的工具。
pip – Python 包和依赖关系管理工具。
pip-tools – 保证 Python 包依赖关系更新的一组工具。
conda – 跨平台,Python 二进制包管理工具。
Curdling – 管理 Python 包的命令行工具。
wheel – Python 分发的新标准,意在取代 eggs。
包仓库
本地 PyPI 仓库服务和代理。
warehouse – 下一代 PyPI。
Warehousebandersnatch – PyPA 提供的 PyPI 镜像工具。
devpi – PyPI 服务和打包/测试/分发工具。
localshop – 本地 PyPI 服务(自定义包并且自动对 PyPI 镜像)。
分发
打包为可执行文件以便分发。
PyInstaller – 将 Python 程序转换成独立的执行文件(跨平台)。
dh-virtualenv – 构建并将 virtualenv 虚拟环境作为一个 Debian 包来发布。
Nuitka – 将脚本、模块、包编译成可执行文件或扩展模块。
py2app – 将 Python 脚本变为独立软件包(Mac OS X)。
py2exe – 将 Python 脚本变为独立软件包(Windows)。
pynsist – 一个用来创建 Windows 安装程序的工具,可以在安装程序中打包 Python本身。
构建工具
将源码编译成软件。
buildout – 一个构建系统,从多个组件来创建,组装和部署应用。
BitBake – 针对嵌入式 Linux 的类似 make 的构建工具。
fabricate – 对任何语言自动找到依赖关系的构建工具。
PlatformIO – 多平台命令行构建工具。
PyBuilder – 纯 Python 实现的持续化构建工具。
SCons – 软件构建工具。
交互式解析器
交互式 Python 解析器。
IPython – 功能丰富的工具,非常有效的使用交互式 Python。
bpython- 界面丰富的 Python 解析器。
ptpython – 高级交互式Python解析器, 构建于python-prompt-toolkit 之上。
文件
文件管理和 MIME(多用途的网际邮件扩充协议)类型检测。
imghdr – (Python 标准库)检测图片类型。
mimetypes – (Python 标准库)将文件名映射为 MIME 类型。
path.py – 对 os.path 进行封装的模块。
pathlib – (Python3.4+ 标准库)跨平台的、面向对象的路径操作库。
python-magic- 文件类型检测的第三方库 libmagic 的 Python 接口。
Unipath- 用面向对象的方式操作文件和目录
watchdog – 管理文件系统事件的 API 和 shell 工具
日期和时间
操作日期和时间的类库。
arrow- 更好的 Python 日期时间操作类库。
Chronyk – Python 3 的类库,用于解析手写格式的时间和日期。
dateutil – Python datetime 模块的扩展。
delorean- 解决 Python 中有关日期处理的棘手问题的库。
moment – 一个用来处理时间和日期的Python库。灵感来自于Moment.js。
PyTime – 一个简单易用的Python模块,用于通过字符串来操作日期/时间。
pytz – 现代以及历史版本的世界时区定义。将时区数据库引入Python。
when.py – 提供用户友好的函数来帮助用户进行常用的日期和时间操作。
文本处理
用于解析和操作文本的库。
通用
chardet – 字符编码检测器,兼容 Python2 和 Python3。
difflib – (Python 标准库)帮助我们进行差异化比较。
ftfy – 让Unicode文本更完整更连贯。
fuzzywuzzy – 模糊字符串匹配。
Levenshtein – 快速计算编辑距离以及字符串的相似度。
pangu.py – 在中日韩语字符和数字字母之间添加空格。
pyfiglet -figlet 的 Python实现。
shortuuid – 一个生成器库,用以生成简洁的,明白的,URL 安全的 UUID。
unidecode – Unicode 文本的 ASCII 转换形式 。
uniout – 打印可读的字符,而不是转义的字符串。
xpinyin – 一个用于把汉字转换为拼音的库。

standard libs:itertools http://docs.python.org/2/library/itertools.htmlfunctools 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底层一点,推荐第三方的库requestsos/sys 系统,环境相关Queue 队列pickle/cPickle 序列化工具hashlib md5, sha等hash算法cvsjson/simplejson python的json库,据so上的讨论和benchmark,simplejson的性能要高于jsontimeit 计算代码运行的时间等等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 browsingpycurl https://pypi.python.org/pypi/pycurl cURL library module for PythonFabric 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 Humansflask 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 模块的 极佳选择

standard libs:itertools http://docs.python.org/2/library/itertools.htmlfunctools 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底层一点,推荐第三方的库requestsos/sys 系统,环境相关Queue 队列pickle/cPickle 序列化工具hashlib md5, sha等hash算法cvsjson/simplejson python的json库,据so上的讨论和benchmark,simplejson的性能要高于jsontimeit 计算代码运行的时间等等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 browsingpycurl https://pypi.python.org/pypi/pycurl cURL library module for PythonFabric 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 Humansflask 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 模块的 极佳选择

standard libs:itertools http://docs.python.org/2/library/itertools.htmlfunctools 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底层一点,推荐第三方的库requestsos/sys 系统,环境相关Queue 队列pickle/cPickle 序列化工具hashlib md5, sha等hash算法cvsjson/simplejson python的json库,据so上的讨论和benchmark,simplejson的性能要高于jsontimeit 计算代码运行的时间等等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 browsingpycurl https://pypi.python.org/pypi/pycurl cURL library module for PythonFabric 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 Humansflask 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 模块的 极佳选择

扩展阅读:python常用函数大全 ... python常见的库 ... python标准库一览表 ... python模块库大全 ... 十大常用python库 ... 列出python五个标准库 ... python代码大全 ... python自带的4个标准库 ... python教程 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网