Practical solutions

Python How-To's How-To Guides

Solve the problem. Keep building. The collection of Python-related howtos

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Validate Email Address in PythonThis tutorial shows how to validate email address in Python using built-in features and libraries. How to Unpack Operator ** in PythonThis tutorial discusses the unpack operator in Python. How to Manage Segmentation Fault in PythonThis tutorial describes how to detect and manage your Python code to know where segmentation faults occur from. How to Get Frequencies of List Elements Using PythonThis short article explains different ways to get the frequency of elements in a list using Python. How to Fix TypeError: Must Be Real Number, Not STRThis tutorial describes how to solve the TypeError: must be real number, not str involving real numbers and string mismatch in Python. How to Fix TypeError: Iteration Over Non-SequenceThis tutorial will teach you to fix TypeError: iteration over non-sequence in Python. How to Fix Fatal Python Error: PyThreadState_Get: No Current ThreadThis tutorial describes what causes and how to deal with Fatal Python error: PyThreadState_Get no current thread error message. How to Create Getter and Setter in PythonThis tutorial describes how to create an OOP getter and setter in Python. How to Call Java From PythonThis article will discuss several ways to call Java from Python using multiple Java to Python libraries. How to Use Log4j With the Help of Logging Library in PythonThis article explains log4j, its working, and its importance to use. We will also explore how to use log4j inside the Python programming language with the help of the logging library. How to Sort List of Dictionaries in PythonThis tutorial discusses how to sort a list of dictionaries in Python. How to Install Python Package Without PipThis article demonstrates how to install a python package without pip in Python. Python Regular Expression to Match a Multiline Block of TextThis tutorial demonstrates how to find and match multiple lines of text using regular expressions in Python. How to Use Cookies in Python RequestsThis tutorial demonstrates how to use cookies in Python using requests.get() and stay connect using Session() class. How to Find Prime Factors in PythonThis tutorial discusses performing prime factorization in Python. How to Calculate Date Using Python Timedelta MonthsThis article discusses calculating the date six months from the current date in Python. How to Read Environment Variables From Env File in PythonThis article provides two methods to import environment variables into Python codes. The first read variables directly from a local environment file, whereas the other uses a shell script to automate the process. How to Get Home Directory in PythonOne can get the path of the home directory using the os.path.expanduser or pathlib library in Python. How to Use Global Variables Across Multiple Files in PythonThis is a short article on using global variables across multiple files in Python. How to Send UDP Packet in PythonThis tutorial demonstrates how we can send UDP packets using Python. How to Send Function in Python GeneratorsThis tutorial demonstrates how to use a generator's send() function in Python. How to Print Degree Symbol in PythonThis tutorial demonstrates various ways on how to print the degree symbol in Python. How to Custom Search Engine Using Google API in PythonThis article explains how to create a custom search engine and get an API key. Two methods are given to get the API key, one activated and another inactive. Two program examples demonstrate how to implement the CSE and API key in Python. How to Use Python Decorators to Retry Code BlocksThis tutorial describes how to use decorators to retry code blocks upon certain exceptions and conditions in Python.