Why do I like Python? For starters, this is an easy programming language to learn for another reason: the sheer number of third-party libraries out of the box, and the 230,000 user-supplied packages that make Python truly powerful and popular.

In this article, I’ve selected 15 of the most useful packages to describe their functions and features.

1. Dash

Dash is a relatively new package that is ideal for building data visualization apps in pure Python, making it particularly suitable for anyone working with data. Dash is a mixture of Flask, Plotly. Js and React.js.

2. Pygame

Pygame is a Python decorator for the SDL multimedia library. SDL(Simple DirectMedia Layer) is a cross-platform development library designed to provide low-level interfaces to:

  • audio

  • The keyboard

  • The mouse

  • The joystick

  • OpenGL and Direct3D based graphics hardware

Pygame is highly portable and runs on almost all platforms and operating systems. Although it has a sophisticated game engine, you can also use this library to play MP3 files directly from Python scripts.

3. Pillow

Pillow is dedicated to working with images, and you can use the 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 see it quickly, look at the following code example (loading and rendering images) :

4. Colorama

Colorama allows you to use colors on terminals, which is great for Python scripts. The documentation is short and interesting, and can be found on the Colorama PyPI page.

5. JmesPath

Using JSON in Python is easy because it maps well to the Python dictionary. In addition, 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 use JSON, I can consider using Python.

JMESPath makes Python working with JSON much easier by allowing you to explicitly specify how elements are extracted from JSON documents. Here are some basic examples to give you an idea of what it can do:

6. Requests

Built on the world’s most downloaded Python library, URllib3, Requests makes Web Requests very simple, powerful, and versatile.

The following code example illustrates how simple requests is to use.

Requests can do all the advanced work you can think of, such as:

  • certification

  • Using cookies

  • Perform POST, PUT, and DELETE operations

  • Use a custom certificate

  • Session usage

  • Using the agent

7. Simplejson

What’s wrong with native JSON modules in Python? No! In fact, Python’s JSON is SimpleJSON. This means that Python has taken a version of SimpleJSON and incorporated it into each distribution. But using SimpleJSON has some advantages:

  • It is available in more Python versions.

  • It is updated more frequently than the accompanying version of Python.

  • It has an (optional) section written in C, making it very fast.

Because of these facts, you’ll often see the following in scripts that use JSON:

I’ll just use the default JSON unless you specifically need to:

  • speed

  • Something that’s not in the standard library

Simplejson is much faster than JSON because it implements some key parts in C. Unless you’re dealing with millions of JSON files, you’re not going to be interested in this speed.

8. Emoji

The Emoji library is interesting, but not everyone likes Emoji packs, which are useful for analyzing perspective media data.

Here is a simple code example:

9. Chardet

You can use the CharDET module to detect the character set of a file or data stream. This is useful when analyzing large amounts of random text, for example. However, you can also use it when working with remotely downloaded data when you don’t know what the character set is.

10. Python-dateutil

The Python-dateutil module provides a powerful extension to the standard Datetime module. My experience is that where the regular Python date-time function ends, python-dateutil shows up.

You can do a lot of great things with this library. I limit these examples to those I find particularly useful: dates in a fuzzy analysis log file, such as:

See the full documentation for more features, such as:

  • Calculates the relative delta (next month, next year, next Monday, last week of the month, etc.) and the relative delta between two objects on a given date.

  • Using a superset of the iCalendar specification, dates are computed according to the repetition rule.

  • Time zone (tzinfo) implementation of tzfile file (/etc/localtime, /usr/share/zoneinfo, etc.), TZ environment string (all known formats), iCalendar format file, given scope (with the help of relative increments), Local computer time zone, fixed offset time zone, UTC time zone, and Windows registrie-based time zone.

  • Internal up-to-date world time zone information based on olson database.

  • Calculate the Date of Easter Sunday in any year using Western, Orthodox, or Julian algorithms.

11. Progress bar: Progress and TQDM

There’s a bit of cheating here, because these are two packages, but it’s unfair to ignore one of them.

You can create your own progress bar, which might be fun, but using the Progress or TQDM package is faster and less error-prone.

progress

With this package, you can easily create a progress bar:

tqdm

TQDM has much the same functionality, but seems to be up to date. Let’s start with some demos in GIF form:

12. IPython

I’m sure you know Python’s interactive shell, which is a great way to run Python. But do you also know IPython Shell? If you use interactive shells a lot, but you don’t know IPython, you should check it out!

Some of the features provided by the enhanced IPython shell include:

  • Comprehensive object introspection.

  • Enter a history that persists across sessions.

  • Caches the output during a session with automatically generated references.

  • TAB completion, which by default supports completion of Python variables and keywords, filenames, and function keywords.

  • The “magic” command, used to control the environment and perform many IPython or operating system-related tasks.

  • Session logging and reloading.

  • Integrated access to the PDB debugger and Python profiler.

  • A little-known feature of IPython: its architecture also allows parallel and distributed computing.

IPython is the heart of Jupyter Notebook, an open source Web application that lets you create and share documents containing live code, equations, visualizations, and narrative text.

13. Homeassistant

I love home automation. It was a hobby for me, but I still apologize for it, because it now controls most of our house. I use the Home Assistant to tie together all the systems in the house. Although it is indeed a complete application, you can also install it as the Python PyPI package.

  • Most of our light fixtures are automated, as are the blinds.

  • I monitor our gas usage, electricity usage and production (solar panels).

  • I can track the location of most phones and initiate operations when I enter an area, such as turning on the garage light when I get home.

  • It can also control all of our entertainment systems, such as Samsung TVS and Sonos speakers.

  • It automatically discovers most devices on the network, making it very easy to get started.

I’ve been using Home Assistant every day for three years and it’s still in beta, but it’s the best platform OF all I’ve tried. It integrates and controls various devices and protocols, and is free and open source.

If you are interested in automating your home, make sure you have the opportunity! If you want to learn more, please visit their official website. If you can, install it on Raspberry Pi. This is by far the easiest and safest way to get started. I installed it on a more powerful server inside the Docker container.

14. Flask

Flask is my starter library for creating fast Web services or simple websites. It’s a microframework, which means Flask aims to keep the core simple but extensible. There are over 700 official and community extensions.

If you know you will be developing a large Web application, you may want to explore a more complete framework. The most popular in this category is Django.

15. BeautifulSoup

If you extract some HTML from the Web site, you need to parse it to get what you actually need. Beautiful Soup is a Python library for extracting data from HTML and XML files. It provides easy ways to navigate, search, and modify parse trees. It is very powerful and can handle all kinds of HTML even if it is broken. Trust me, HTML gets broken a lot, so this is a very powerful feature.

Some of its main features:

  • Beautiful Soup automatically converts incoming documents to Unicode and outgoing documents to UTF-8. You don’t have to worry about coding.

  • Beautiful Soup sits on top of popular Python parsers such as LXML and HTML5lib, allowing you to try different parsing strategies or increase flexibility.

  • BeautifulSoup parses whatever you provide and does the work of traversing the tree for you. You can tell it to “find all links,” or “Find the table title with bold text, and give me that text.”

  • Well, that’s all for today’s sharing. If you’re interested in Python, join us.Python Learning communicationSkirt 】, receive free learning materials and source code.