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.
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:
//m.sbmmt.com/link/502cc2c94be1a7c4ca7ef25b8b50bc04
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:
//m.sbmmt.com/link/ae502204564aafbffb712be630e3910b
//m.sbmmt.com/link/52130c418d4f02c74f74a5bc1f8020b2
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:
##//m.sbmmt.com/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'
//m.sbmmt.com/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://m.sbmmt.com/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:
//m.sbmmt.com/link/988f9153ac4fd966ea302dd9ab9bae15
这里有点作弊,因为这是两个包,但忽略其中之一是不公平的。
您可以创建自己的进度条,这也许很有趣,但是使用progress或tqdm程序包更快,更不容易出错。
借助这个软件包,您可以轻松创建进度条:
from progress.bar import Bar bar = Bar('Processing', max=20) for i in range(20): # Do some work bar.next() bar.finish()
tqdm的功能大致相同,但似乎是最新的。
from tqdm import tqdm for i in tqdm(range(10000)): ...
以gif动画形式进行一些演示:
home assistant是一个运行在python 3上的家庭自动化平台。它能够在家里对所有设备进行跟踪和控制,为自动化控制提供了一个平台。
它现在控制着我们房屋的大部分。我使用Home Assistant将房子中的所有系统捆绑在一起。尽管它确实是一个完整的应用程序,但是您也可以将其安装为Python PyPI软件包。
项目地址:
//m.sbmmt.com/link/16002f7a455a94aa4e91cc34ebdb9f2d
python-dateutil模块提供了对标准datetime模块的强大扩展。
您可以使用此库做很多很棒的事情。比如计算相对增量(下个月,明年,下周一,该月的最后一周等)和两个给定日期对象之间的相对增量。
项目地址:
//m.sbmmt.com/link/a35d11c2f995c60b0341a9c777f1ae03
Pygame 是一组用来开发游戏软件的 Python 程序模块,基于 SDL 库的基础上开发。
允许你在 Python 程序中创建功能丰富的游戏和多媒体程序,旨在提供对以下内容的低级接口:
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!