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 Convert Unicode to ASCII in PythonWe will learn with this explanation about how to encode Unicode into bytes, see the different ways to encode system and how to convert Unicode to ASCII in Python. How to Fix Python TypeError: Must Use Keyword Argument for Key FunctionThis article tackles about how to use simple and powerful ways to sort a list of items and use the lambda function inside the sort() method. We also discuss what are the reasons we get failed to execute sort() method in Python. How to Fix Valueerror: Expected 2d Array, Got 1d Array InsteadIn Python, the Expected 2D array got a 1D array instead error occurs when we are passing a 1-dimensional array in a function but the function requires 2-dimensional array, so instead of passing a 2D array, we are passing Array with Single Dimension. How to Step Through Python CodeIn this article, we will discuss using the Python debugger to step through code. We will explain from scratch about a command-line tool which is called PDB. We will also learn how to step through code with the help of Python IDLE. Mastering Numerical Solutions With Fsolve in PythonThis article will explore how we can use fsolve to find a solution in Python. How to Profile a Python Code Line by LineThis article discusses the line-by-line profiling of the code written in Python. How to Convert Dictionary to Datacalss in PythonThis tutorial demonstrates how to convert a nested dict into a data class. How to Create Local HTTP Server in PythonThis article demonstrates how to create an HTTP server using Python. Python Functools Partial FunctionThis article describes how we use the partial function, which comes along with the functools library with an example. This shows how the attributes and partial function are passed when called. How to Utilize Bitwise_AND on an Image Using OpenCVIn this article, we will see how to use the bitwise_AND operate using the OpenCV library. How to Open and Edit Files in the Linux Terminal Using VimA comprehensive guide on how to use Linux terminal to open, edit, save and delete script files. How to Compress Image in PythonOne can compress an image using the PIL library in Python. Cron Like Schedular in PythonThis short article is a guide to schedule tasks using the schedule module in Python automatically. How to Calculate the Distance Between Two GPS Points in PythonIn this tutorial, we will learn how to calculate the distance between two GPS points using the Haversine formula and the mpu and geopy libraries. How to Mock Function in PythonThis article discusses mocking a function with the Python unittest library by using pytest-mock, which is not a built-in Python package, to make testing with Mock a success. How to Get Dictionary Intersection in PythonThis article discusses the different methods to perform intersection on two dictionaries or multiple dictionaries in Python for creating a new one easily and efficiently. Python Two-Sample T-TestIn this article, we discuss what two-sample t-test is and how to perform it using Python. Mainly we discuss three methods: using SciPy, Pingouin and Statsmodels. We have used a scenario as an example to understand the concept in each method. How to Send Emails to Multiple Addresses Using PythonThis article demonstrates how to send emails to multiple addresses using Python. Python Password HashingWe will learn about password hashing and how to encrypt a salt and hash password with a third-party library called bcrypt. How to Set Environment Variable in Python ScriptEnvironment variables are usually set manually inside a system, but we will use Python scripts to interact with environment variables. Adaptive Threshold Using OpenCVIn this article, we will see what is adaptive thresholding in detail using OpenCV. How to Use PhantomJS in PythonThis article summarizes the concept of PhantomJS in Python. How to Fix the Python TypeError: List Indices Must Be Integers, Not ListWe will demonstrate how to resolve list indices must be integer not list error in Python. Invalid Syntax in PythonWe will demonstrate how to resolve invalid syntax in Python.