Home > Article > Backend Development > Highly recommended 15 high-level Python libraries that get twice the result with half the effort
Why do I like Python? For beginners, this is a simple and easy-to-learn programming language;Another reason:The large number of third-party libraries available out of the box is exactly what 230,000 user-contributed packages make Python truly powerful and popular.
Dash is a relatively new software package, it is built in pure Python Ideal for data visualization apps and therefore especially suitable for anyone working with data. Dash is a hybrid of Flask, Plotly.js and React.js.
Audio
Graphics hardware based on OpenGL and Direct3D
Pygame is highly portable and can be used on almost all platforms and operating systems run on. Although it has a complete game engine, you can also use this library to play MP3 files directly from Python scripts.
Pillow is specially designed for processing images. You can use this library to create miniatures. Thumbnail, 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, look at the following code example (loaded and rendered):
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:
Authentication
Use cookies
Perform POST, PUT, DELETE, etc.
Use a custom certificate
Use Session
Using a proxy
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.
I would just use the default json unless you specifically need it:
Speed
Things not in the standard library
Simplejson is much faster than json because it implements some key parts in C. Unless you are processing millions of JSON files, you won't be interested in this kind of speed.
The Emoji library is very interesting, but not everyone likes emoticons. Emoji packages are very useful when analyzing perspective media data.
The following is a simple code example:
See full documentation for more functions, for example:
Calculate relative increment (next month, next year, next Monday, last week of the month, etc.) and the relative delta between two given date objects.
Uses a superset of the iCalendar specification to calculate dates based on repetition rules.
Time zone (tzinfo) implementation for tzfiles (/etc/localtime, /usr/share/zoneinfo, etc.), TZ environment strings (all known formats ), iCalendar format file, given range (with the help of relative increments), local computer time zone, fixed offset time zone, UTC time zone and Windows registry based time zone.
# Internal latest world time zone information based on the Olson database.
Calculate the Easter Sunday date for any year using the Western, Orthodox or Julian algorithm.
A little cheating here, because these are two package, but it would be unfair to ignore one of them.
You can create your own progress bar, which might be fun, but using the progress or tqdm packages is faster and less error-prone.
progress
With the help of this package you can easily create progress bars:
imgComprehensive object introspection.
#Input history persists across sessions.
#Cache output results during a session with automatically generated references.
Tab completion, supports completion of python variables and keywords, file names and function keywords by default.
# "Magic" command used to control the environment and perform many IPython or operating system related tasks.
# Session recording and reloading.
#Integrated access to the pdb debugger and Python profiler.
A little-known feature of IPython: its architecture also allows for parallel and distributed computing.
I love home automation. It was a bit of a hobby for me, but one I still feel deeply sorry for as it now controls a large portion of our house. I use Home Assistant to tie together all the systems in the house. Although it is indeed a complete application, you can also install it as a Python PyPI package.
Most of our light fixtures are automated, as are our blinds.
#I monitor our natural gas usage, electric usage and production (solar panels).
#I can track the location of most phones and initiate actions when they enter an area, such as turning on the garage lights when I get home.
# It can also control all our entertainment systems, such as Samsung TVs and Sonos speakers.
#It can automatically discover most devices on the network, so it is very easy to get started.
I've been using Home Assistant daily for 3 years now, it's still in beta, but it's the best platform out of all the platforms I've tried. It is able to integrate and control a variety of devices and protocols, and is all free and open source.
If you are interested in automating your home, make sure you get the chance! If you want to know more, please visit their official website. If you can, install it on your Raspberry Pi. This is by far the easiest and safest way to get started. I installed it on a more powerful server inside a Docker container.
Flask is my entry-level library for creating fast web services Or a simple website. This is a microframework, which means that 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 look into a more complete framework. The most popular in this category is Django.
If you extracted some HTML from your website, you need to parse it to get the actual content you want. Beautiful Soup is a Python library for extracting data from HTML and XML files. It provides simple methods to navigate, search and modify parse trees. It's very powerful and, even if broken, is capable of handling all kinds of HTML. Trust me, HTML is often broken, 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 need to think 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 walking the tree for you. You can tell it "Find all links," or "Find the table title with bold font and give me that text."
The above is the detailed content of Highly recommended 15 high-level Python libraries that get twice the result with half the effort. For more information, please follow other related articles on the PHP Chinese website!