Python

Money and Business

zipfile to compress and uncompress ZIP files in Python

The zipfile module of the Python standard library can be used to compress files into ZIPs and uncompress ZIP files. It i...
Money and Business

Getting the image size (width and height) with Python, OpenCV and Pillow(PIL)

In Python there are several libraries for handling images, such as OpenCV and Pillow (PIL). This section explains how to...
Money and Business

Getting the size of a file or directory (folder) in Python

Using the Python standard library os, you can get the size (capacity) of a file or the total size of the files contained...
Money and Business

Compressing a directory (folder) into a zip or tar in Python

When compressing an entire directory (folder) into a zip file in Python, you can use os.scandir() or os.listdir() to cre...
Money and Business

Ignoring (disabling) escape sequences in Python with raw strings

'...', "..."In Python, if you prefix these string literals with one of the following characters, the value will ...
Money and Business

Get the day of the week or month from a date in Python as a string (e.g. German or English)

Using Python's standard library datetime, you can create a datetime object from a date string and get the name of th...
Money and Business

Removing elements from a list (array) in Python: clear(), pop(), remove(), del

To remove an element from a list (array) of type list in Python, use the list methods clear(), pop() and remove(). You c...
Money and Business

Adding elements to a list (array) in Python: append(), extend(), insert()

To add an element to a list (array) of type list in Python, or to combine another list, use the list methods append(), e...
Money and Business

Shuffle elements in a list in Python

If you want to shuffle (randomly sort) the elements of a list (array) in Python, use the random module of the standard l...
Money and Business

Generating random decimals and integers in Python, including random(), randrange(), and randint()

Random numbers can be generated using the random(), uniform(), randange(), and randint() functions in the random module ...
Copied title and URL