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 Remove Whitespace From a String in PythonIt introduces different methods of removal of whitespace in a string. You could strip the whitespace either with Python string split, replace method, or use Python regex functions. How to Check Variable Type in PythonThis article explains the various ways in which you can check the type of the variable and how to change the type of variables in python. How to Remove Duplicates From List in PythonIn this article, we will discuss how to remove duplicates from a list in Python using the set data structure and OrderDict. How to Calculate Factorial in PythonIn this article, we will see how to find the factorial of a number by using iteration, recursion, and the built-in math module in Python. How to Remove All the Occurrences of an Element From a List in PythonIn this article, we will see how we can remove all the occurrence of an element from a List in Python. How to Run Python in Notepad++In this article, we will see how to run Python file in the Notepad++ text editor. How to Convert a Dictionary to a List in PythonThis article introduces how to convert a dictionary into a list in Python. How to Exit a Function in PythonIn this article, we will see how a Python function exits with the help of the return statement. How to Implement a Tree Data Structure in PythonIn this article, we will see how to implement a tree data structure in Python. How to Get JSON From URL in PythonIn this tutorial, we will see how to get, parse and access the JSON data using built in modules in Python. How to Convert Int to Bytes in Python 2 and Python 3pack function in the Python struct module could convert int to bytes in both Python 2.7 and Python 3, and int_to_bytes() from Python 3.1 could convert int to bytes with the specified byte order. How to Convert Bytes to Int in Python 2.7 and 3.xstruct.unpack method in Python 2.7/Python 3.x and int.from_bytes() method in Python 3.x could convert bytes to integers. How to Remove Commas From String in PythonTo remove comma from a string in Python, we can use the str.replace() method and the re package. How to Play Mp3 File Using PythonThis tutorial explains how to play mp3 files with Python using packages like pygame, vlc, playsound and webbrowser. Lexicographical Order in PythonThis tutorial demonstrates what is lexicographical order in Python and discuss the different methods to achieve it. Python Dynamic Variable NameThis tutorial demonstrates how to create dynamic variable name in Python. Most Common Docstring Patterns in PythonLearn about the most common docstring patterns in Python. Python Teradata ConnectionThis article demonstrates the Teradata connection in Python. Introduction to Urljoin in PythonThis tutorial demonstrates how to form URLs using the urljoin() module in Python and educates about the behaviour of this module when using it. Ways to Remove xa0 From a String in PythonThis article demonstrates the methods on how to remove xa0 from a string in Python. Python Multiple if Statements on One LineThis tutorial demonstrates to write an if-elif-else statement on one line in Python. Case Insensitive Regex in PythonThis article includes two ways to search for a pattern within a text. One of the ways is to use the re.IGNORECASE flag and the re.I flag, and the second way is to use the case insensitive marker denoted by (?i). Top 10 Tools for Python DevelopersIt introduces top 10 tools for python developers. String Interpolation in PythonLearn about the String Interpolation in Python