


Ten useful Python utility libraries, I recommend you try them!
Why do I like Python? It's an easy-to-learn programming language for beginners, for another reason: the large number of third-party libraries available out of the box, and the 230,000 user-contributed packages that make Python truly powerful and popular.
In this article, I selected 10 of the most useful software packages and introduced their functions and features.
1. Dash
Dash is a Python library for building web-based applications without JavaScript.
Dash is also a user interface library for creating analytical web applications. Those who use Python for data analysis, data mining, visualization, modeling, instrument control, and reporting can use Dash right away.
Dash is built on Plotly.js, React, and Flask to combine modern UI elements like dropdowns, sliders, and graphs with your analytical Python code .
Project address:
https://www.php.cn/link/502cc2c94be1a7c4ca7ef25b8b50bc04
2. Pillow
Pillow is specifically designed for working with images, you can use this library to create thumbnails, convert between file formats, rotate, apply filters, display images and more. This is ideal if you need to perform batch operations on many images.
To understand it quickly, take a look at the following code example (loading and rendering images):
Help documentation:
https://www.php.cn/link/ae502204564aafbffb712be630e3910b
https://www.php.cn/link/52130c418d4f02c74f74a5bc1f8020b2
3. Colorama
Colorama allows you to work with colors in the terminal, perfect for Python scripts. The documentation is short and sweet and can be found on the Colorama PyPI page.
Project address:
##https://www.php.cn/link/23ef5cf238a3b88085d95adf94c24a25
4. JmesPathWorking with JSON in Python is very easy because JSON maps very well to Python dictionaries. Additionally, Python comes with its own excellent json library for parsing and creating JSON. To me, this is one of its best features. If I need to work with JSON, I might consider using Python. JMESPath makes processing JSON in Python easier by allowing you to explicitly specify how to extract elements from a JSON document. Here are some basic examples to give you an idea of its capabilities:>>> import jmespath >>> path = jmespath.search('foo.bar', {'foo': {'bar': 'baz'}}) 'baz'
https://www.php.cn/link/ 14b7367a28377d4d513a4d3349861d2f
5. SimplejsonWhat’s wrong with the local json module in Python? No! Actually, Python's json is simplejson. Meaning, Python took a version of simplejson and incorporated it into every distribution. But using simplejson has some advantages:- It works on more Python versions. It is updated more frequently than the version that comes with Python. It has the (optional) part written in C, so it's very fast.
https://www.php.cn/link/3c51419c5607de9699da15be1274b4a6
Simplejson is much faster than json because it uses C to implement some key parts. Unless you are processing millions of JSON files, you won't be interested in this kind of speed. 6. EmojiThe Emoji library is very interesting, but not everyone likes emoticons. Emoji packages are very useful when analyzing perspective media data.project address:
https://www.php.cn/link/988f9153ac4fd966ea302dd9ab9bae15
7. 进度条:progress和tqdm
这里有点作弊,因为这是两个包,但忽略其中之一是不公平的。
您可以创建自己的进度条,这也许很有趣,但是使用progress或tqdm程序包更快,更不容易出错。
progress
借助这个软件包,您可以轻松创建进度条:
from progress.bar import Bar bar = Bar('Processing', max=20) for i in range(20): # Do some work bar.next() bar.finish()
tqdm
tqdm的功能大致相同,但似乎是最新的。
from tqdm import tqdm for i in tqdm(range(10000)): ...
以gif动画形式进行一些演示:
8. Homeassistant
home assistant是一个运行在python 3上的家庭自动化平台。它能够在家里对所有设备进行跟踪和控制,为自动化控制提供了一个平台。
它现在控制着我们房屋的大部分。我使用Home Assistant将房子中的所有系统捆绑在一起。尽管它确实是一个完整的应用程序,但是您也可以将其安装为Python PyPI软件包。
- 大多数灯具都是自动化的,百叶窗也是如此。
- 监视我们的天然气用量,电力用量和产量(太阳能电池板)。
- 可以跟踪大多数电话的位置,并在进入一个区域时开始操作,例如当我回家时打开车库灯。
- 它还可以控制我们所有的娱乐系统,例如三星电视和Sonos扬声器。
- 它能够自动发现网络上的大多数设备,因此上手起来非常容易。
项目地址:
https://www.php.cn/link/16002f7a455a94aa4e91cc34ebdb9f2d
9. Python-dateutil
python-dateutil模块提供了对标准datetime模块的强大扩展。
您可以使用此库做很多很棒的事情。比如计算相对增量(下个月,明年,下周一,该月的最后一周等)和两个给定日期对象之间的相对增量。
项目地址:
https://www.php.cn/link/a35d11c2f995c60b0341a9c777f1ae03
10. Pygame
Pygame 是一组用来开发游戏软件的 Python 程序模块,基于 SDL 库的基础上开发。
允许你在 Python 程序中创建功能丰富的游戏和多媒体程序,旨在提供对以下内容的低级接口:
- 音频
- 键盘
- 鼠标
- 游戏杆
- 基于OpenGL和Direct3D的图形硬件
Pygame具有高度的可移植性,几乎可以在所有平台和操作。
The above is the detailed content of Ten useful Python utility libraries, I recommend you try them!. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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



VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

In VS Code, you can run the program in the terminal through the following steps: Prepare the code and open the integrated terminal to ensure that the code directory is consistent with the terminal working directory. Select the run command according to the programming language (such as Python's python your_file_name.py) to check whether it runs successfully and resolve errors. Use the debugger to improve debugging efficiency.

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

The key to running Jupyter Notebook in VS Code is to ensure that the Python environment is properly configured, understand that the code execution order is consistent with the cell order, and be aware of large files or external libraries that may affect performance. The code completion and debugging functions provided by VS Code can greatly improve coding efficiency and reduce errors.

Golang is more suitable for high concurrency tasks, while Python has more advantages in flexibility. 1.Golang efficiently handles concurrency through goroutine and channel. 2. Python relies on threading and asyncio, which is affected by GIL, but provides multiple concurrency methods. The choice should be based on specific needs.
