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 Two Lists Into Dictionary in PythonIt demonstrates how to convert lists into dictionary in Python How to Read First Line of a File in PythonThis tutorial demonstrates how to read the first line of a text file in Python How to Enumerate Dictionary in PythonThis tutorial demonstrates how to use the enumerate Function with a dictionary in Python How to Save a Dictionary to a File in PythonThis tutorial demonstrates how to save a dictionary to a file in Python How to Plot a Python Dictionary in Order of Key ValuesThis tutorial explains how to plot a dictionary in Python. How to Get the First Key in Python DictionaryThis tutorial explains how to get the first key of dictionary in Python. It includes next(), .keys(), list comprehension, dictionary unpacking and items() methods. How to Remove the First Character From the String in PythonThis tutorial explains how to remove the first character from the string in Python How to Remove Special Characters From the String in PythonThis tutorial explains how to remove all the special characters from the string in Python How to Insert String Into a String in PythonThis tutorial demonstrates how to insert a new string into an already existing string How to Check if a String Is Integer in PythonThis tutorial explains how we can check if a string is an integer or not in Python. How to Convert Binary to Int in PythonThis tutorial demonstrates how to convert binary to integer in Python How to Clear the Contents of a File in PythonThis tutorial demonstrates how to clear the contents of a file in Python. How to Import Class From Another File in PythonThis tutorial demonstrates how to import a class from another file in Python How to Get Function Name in PythonIt demonstrates how to output a function name in Python How to Check if Set Is Empty in PythonThis article will discuss the four main methods that can be used to check if a set is empty in Python; the len() function, the bool() function, the set() method, and the not operator. How to Capture Exception Message in PythonThis tutorial demonstrates how to capture exception message in Python How to Sort a List Alphabetically in PythonThis tutorial demonstrates how to sort a list alphabetically in Python How to Loop Through Files in Directory in PythonThis tutorial demonstrates how to loop through the files in a directory in Python How to Find All the Indices of an Element in a List in PythonThis tutorial demonstrates how to find all the occurrences of an element in a list in Python How to Copy List in PythonA Python list can be copied into a new list using different methods. copy(),slicing, list(), list comprehension, deep copy and shallow copy methods are used for this purpose. How to Compare String Case Insensitive String in PythonThere are three main methods used to carry out case insensitive string comparison in python which are lower(), upper() and casefold(). How to Save Dictionary to JSON in PythonThis tutorial demonstrates how to save a dictionary as a json file in Python How to Python Get Filename Without Extension From PathThis tutorial demonstrates how to get file name without extension from the file path in Python How to Get List Intersection in PythonThere are three main methods to perform set intersection on lists in python. These mainly include set intersection, list comprehensions and intersection().