推荐11个实用Python库
1) delorean
非常酷的日期/时间库
from delorean import Delorean
EST = "US/Eastern"
d = Delorean(timezone=EST)
2) prettytable
可以在浏览器或终端构建很不错的输出
from prettytable import PrettyTable
table = PrettyTable(["animal", "ferocity"])
table.add_row(["wolverine", 100])
table.add_row(["grizzly", 87])
table.add_row(["Rabbit of Caerbannog", 110])
table.add_row(["cat", -1])
table.add_row(["platypus", 23])
table.add_row(["dolphin", 63])
table.add_row(["albatross", 44])
table.sort_key("ferocity")
table.reversesort = True
+----------------------+----------+
| animal | ferocity |
+----------------------+----------+
| Rabbit of Caerbannog | 110 |
| wolverine | 100 |
| grizzly | 87 |
| dolphin | 63 |
| albatross | 44 |
| platypus | 23 |
| cat | -1 |
+----------------------+----------+
3) snowballstemmer
非常瘦小的语言转换库,支持15种语言
from snowballstemmer import EnglishStemmer, SpanishStemmer
EnglishStemmer().stemWord("Gregory")
# Gregori
SpanishStemmer().stemWord("amarillo")
# amarill
4) wget
Python的网络爬虫库
import wget
wget.download("
# 100% [............................................................................] 280385 / 280385
5) PyMC
PyMC,一个用于贝叶斯分析的函数库
from pymc.examples import disaster_model
from pymc import MCMC
M = MCMC(disaster_model)
M.sample(iter=10000, burn=1000, thin=10)
[-----------------100%-----------------] 10000 of 10000 complete in 1.4 sec
6) sh
将shell命令作为函数导入Python脚本
from sh import find
find("/tmp")
/tmp/foo
/tmp/foo/file1.json
/tmp/foo/file2.json
/tmp/foo/file3.json
/tmp/foo/bar/file3.json
7) fuzzywuzzy
用于字符串匹配率、令牌匹配等
from fuzzywuzzy import fuzz
fuzz.ratio("Hit me with your best shot", "Hit me with your pet shark")
# 85
8) progressbar
如其名,一个滚动条函数库
from progressbar import ProgressBar
import time
pbar = ProgressBar(maxval=10)
for i in range(1, 11):
pbar.update(i)
time.sleep(1)
pbar.finish()
# 60% |######################################################## |
9) colorama
一个色彩库,可以为文本添加丰富的色彩
10) uuid
一个可以产生唯一uuid的库
import uuid
print uuid.uuid4()
# e7bafa3d-274e-4b0a-b9cc-d898957b4b61
11) bashplotlib
Python的绘图控件,可以绘制直方图、散点图等
$ pip install bashplotlib
$ scatter --file data/texas.txt --pch x
以上就是本文推荐的11个使用的python库了,也许有些你没有见过,但都是些非常棒的pyton库,希望大家能够喜欢。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Steps to install the python library with Tsinghua mirror: 1. Open the terminal or command line interface; 2. Make sure that the Tsinghua mirror source has been configured and set the Tsinghua mirror source as the default source of pip; 3. Run "pip install <package-name> " command to install the Python library; 4. If you need to install a specific version of the library, you can add the version number "pip install <package-name>@<version>" after the installation command.

Hidden Markov Models (HMMs) are a powerful type of statistical model used for modeling sequence data. They have uses in numerous fields including speech recognition, natural language processing, finance, and bioinformatics. Python is a versatile programming language that provides a series of libraries for implementing HMMs. In this article, we will discover unique Python libraries for HMMs and evaluate their functionality, performance and ease of use, sooner or later revealing the best option for your needs. Getting Started with Hidden Markov Models Before diving into these libraries, let’s briefly review the concept of HMMs. HMM is a probabilistic model that represents the transition of a system between hidden states over time. It consists of the following parts - a set of hidden states initial state probability distribution state transition

Quickly uninstall pip: simple operation, clean up useless Python libraries! Article summary: When we use Python to develop projects, we may install many Python libraries, and some libraries may become useless due to changes in project requirements or other reasons. In this case, uninstalling these useless Python libraries can help us save disk space and keep the project tidy. This article will introduce a method to quickly uninstall pip, as well as specific code examples. Text: Python is a very powerful programming language

Use Tsinghua mirror to quickly build a Python library installation environment Introduction: Python is a widely used programming language with a wealth of third-party libraries. When developing projects using Python, you often encounter situations where you need to install various libraries. However, due to limitations of the domestic network environment, sometimes the library download speed from PyPI (PythonPackageIndex) will be very slow or even impossible to connect. In this case, we can use the Tsinghua University mirror station to provide high-speed downloading through the mirror station.

In the daily Python programming process, various third-party libraries are often used. Pip is the most commonly used package management tool for Python. By using it to install and upgrade Python packages, you can make Python programming more efficient and easier. However, due to the differences between domestic and foreign network environments, you may feel confused when using pip to install the Python library. This article will introduce you to some pip tips for installing Python libraries from domestic sources that even novices can learn, and provide specific code examples. Modify pip configuration

To understand the pip acceleration command to speed up the download of Python libraries, specific code examples are required. With the popularity and widespread application of the Python language, using the pip tool to install and manage Python libraries has become an important part of developers' daily work. However, due to network limitations, pip sometimes encounters slow speed when downloading Python libraries, which not only affects development efficiency, but may also delay project progress. To solve this problem, we can speed up Pyt by using the pip speedup command

Tsinghua Mirror shares how to quickly install Python libraries, requiring specific code examples. With the widespread application of Python in data analysis, artificial intelligence and other fields, installing Python libraries has become one of the essential skills for every Python developer. However, due to the usage needs of many developers, domestic and foreign mirror sites may have problems such as slow download speeds and installation failures. In order to solve this problem, Tsinghua University provides domestic users with a Tsinghua Mirror Station to speed up the downloading and installation of Python libraries. This article will introduce the use of clear

Python libraries are used through the steps of importing the library, using functions and constants in the library, aliases, and viewing the documentation in the library. Commonly used Python libraries include: 1. Numpy; 2. Pandas; 3. Matplotlib; 4. Requests; 5. TensorFlow.
