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 Detect Edge in Python OpenCVThis tutorial will discuss detecting edges in an image using the canny or Sobel edge detector in OpenCV. How to Create an IRC Bot in Python 3This tutorial discusses how to create an IRC bot in Python. How to Pass List to Function in PythonThis tutorial discusses how to pass list as an argument to a function in Python. How to Implement a Touch File in PythonThis tutorial discusses how to implement a touch file in Python. How to Fix Inverse of Matrix in PythonThis tutorial discusses the use of different functions or methods in finding the inverse of a matrix in Python. How to Split List Into Sublists in PythonThis article delves into various methods to split lists into sublists or multiple small lists in Python. How to Convert Boolean Values to Integer in PythonThis tutorial discusses the methods to convert boolean values to integer in Python. We can use if/else, int(), and map(). How to Find First Occurrence in a String in PythonThere are 2 main methods that can be used to find the first occurrence of a substring inside a string in Python: the find() function and the index() function. How to Convert List to Matrix in PythonThis tutorial discusses how to convert a list to a matrix in Python. How to Detect Object in Python OpenCVThis tutorial will discuss detecting objects present in an image or video stream using the cascade classifier and YOLO in OpenCV. How to Subtract Background in OpenCVThis tutorial will discuss removing background from an image using cvzone, MOG2, and KNN in OpenCV. How to Get the N-th Occurrence of a Substring in a String in PythonWe'll discuss several ways to find the nth occurrence of a substring in a string. We have used two python functions, find() and split() and a regular expression method to find to nth occurrence of a substring. How to Split Strings by Tab in PythonThis tutorial demonstrates how to split strings by tab in Python. How to Parse HTML Data in PythonThis article explains the different ways to parse HTML data in Python. We will be looking at different Python functions or modules that will help us parse the HTML format data. How to Extract Elements From a Database Using fetchall() in PythonThis article explains the implementation of the fetchall() method in Python. The program creates a cursor for the database and handles exceptions for errors. The output derived gives a list of elements from a specific table provided in the query. How to Wrap Text in PythonThis tutorial demonstrates how to wrap text in Python. How to Stringify JSON in PythonThis article discusses the counterpart of the stringify function in Python and its uses. How to Process Finished With Exit Code 0 in PythonThis tutorial demonstrates what it means when we get an exit code 0 in Python. How to Calculate the Sum of Digits in PythonThis tutorial discusses how to find the sum of digits in Python. How to Connect to a MySQL Database in PythonThere are 3 main methods that can connect to a MySQL database in Python; the default MySQL connector for Python, the pymysql library, and the mysqlclient library. How to Join List of Lists in PythonThis article explains flattening, why a list is better than nested lists, and discusses various ways to join a list of lists in python. How to Import Files in PythonThis article explains how to import files in Python. How to Implement Union-Find Algorithm in PythonThis tutorial discusses how to implement the union-find algorithm in Python. How to Implement Timeout in Python RequestsDifferent examples of timeout using modules requests and eventlet is demonstrated in this article. The reader will learn how to implement a timeout, giving read and connect timeouts separately and using a third-party library.