In this article, I have selected 12 of the most useful software packages to share with you. I believe you will learn something!
Dash is relatively new. It is ideal for building data visualization applications using pure Python, so it is especially suitable for those who work with data. Dash is a hybrid of Flask, Plotly.js and React.js.
#Dash quickly puts the content you want into beautiful dashboards without touching a single line of Javascript.
Pygame is the Python wrapper module of the SDL multimedia library. Simple DirectMedia Layer is a cross-platform development library designed to provide low-level access to OpenGL and Direct3D Pygame's audio keyboard mouse joystick graphics hardware and is highly portable and can run on almost all platforms and operating systems.
It has a complete game engine, and you can also use the library to play MP3 files directly from Python scripts.
Pillow is a fork of the Python image library. 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 understand it quickly, this is how to display an image from Python code:
from PIL import Image im = Image.open("kittens.jpg") im.show() print(im.format, im.size, im.mode) # JPEG (1920, 1357) RGB
from colorama import Fore, Back, Style print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Style.RESET_ALL) print('back to normal now')
import jmespath # Get a specific element d = {"foo": {"bar": "baz"}} print(jmespath.search('foo.bar', d)) # baz # Using a wildcard to get all names d = {"foo": {"bar": [{"name": "one"}, {"name": "two"}]}} print(jmespath.search('foo.bar[*].name', d)) # [“one”, “two”]
import requests r = requests.get('https://api.github.com/user', auth=('user', 'pass')) r.status_code # 200 r.headers['content-type'] # 'application/json; charset=utf8' r.encoding # 'utf-8' r.text # u'{"type":"User"...' r.json() # {u'disk_usage': 368627, u'private_gists': 484, ...}
try: import simplejson as json except ImportError: import json
import emoji result = emoji.emojize('Python is :thumbs_up:') print(result) # 'Python is ' # You can also reverse this: result = emoji.demojize('Python is ') print(result) # 'Python is :thumbs_up:'
$ chardetect somefile.txt somefile.txt: ascii with confidence 1.0
from dateutil.parser import parse logline = 'INFO 2020-01-01T00:00:01 Happy new year, human.' timestamp = parse(logline, fuzzy=True) print(timestamp) # 2020-01-01 00:00:01
from progress.bar import Bar bar = Bar('Processing', max=20) for i in range(20): # Do some work bar.next() bar.finish()
The above is the detailed content of Reduce costs and increase efficiency! 12 must-try Python toolkits!. For more information, please follow other related articles on the PHP Chinese website!