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 Get Hour and Minutes From Datetime in PythonThis tutorial demonstrates how to get time as hour and minute using the datetime module in Python. How to Calculate Cube Root in PythonThis tutorial demonstrates how to get a cube root of an integer or a float variable in Python. How to Check Element Not in a List in PythonThis tutorial demonstrates how to check if an element not in a list in Python. How to Use del Keyword in PythonThe del keyword is used to delete objects. As everything in Python is an object, so that the del keyword can be used to delete everything in Python. How to Get Parent Directory in PythonThis tutorial demonstrates how to get parent directory of a path in Python How to Add Character to String in PythonThis tutorial demonstrates how to add a character to a string in Python. How to Split a String Into a Character Array in PythonThis tutorial demonstrates how to split a string into an array of characters in Python. How to Return Multiple Values From a Function in PythonThis tutorial demonstrates how to return multiple values from a function in Python How to Convert String to Double in PythonThis tutorial demonstrates how to convert a string type to a numeric variable with a double precision in Python How to Capitalize First Letter of Each Word in PythonThis tutorial demonstrates how to capitalize first letter of each word in a string in Python How to Calculate Square Root in PythonThis tutorial demonstrates how to calculate the square root of a number in Python How to Split List Into Chunks in PythonA Python list can be divided into different chunks of equal sizes. It can be done by using user-defined functions, list comprehension, itertools, lambda, lambda and islice, and NumPy methods. How to Remove Quotes From String in PythonThis article explores the different methods to remove quotes from a string in Python. How to Print List Without Square Brackets in PythonThis tutorial demonstrates how to print a list without square brackets in Python How to Print Tab in PythonA tab can be inserted into the string or in the file by using Python code. How to Implement Quick Sort Algorithm in PythonThis tutorial demonstrates how to implement and apply quick sort on an array in Python How to Convert Image to Grayscale in PythonThis tutorial demonstrates how to convert an image to grayscale in Python How to Append Multiple Elements to List in PythonWe can append multiple elements to a list by manually adding the values, or we can use append(), extend(), concatenation, and itertools methods. How to Overwrite a File in PythonThis article explores various methods to overwrite files in Python. Learn how to use the open() function with w mode, read and overwrite files using r+ mode, utilize shutil modules copyfile() function, use os modules remove() and rename() functions, and employ os.replace() method and pathlib modules write_text method for file overwriting in Python. Safeguard your data while efficiently updating file content. How to Print Bold Text in PythonIn this article we'll discuss the ways to print bold text in Python. How to Get List Shape in PythonThis article explores methods to determine the shape of lists in Python, covering one-dimensional, nested, and multi-dimensional lists, along with handling irregularly nested lists. How to Download Image in PythonThere are 3 different methods for downloading images in python. These methods include urllib.requests.urlretrieve(url, filename), urllib.requests.urlopen(url) and using the requests module How to Capitalize the First Letter of a String in PythonWe can use capitalize(), title(), capwords(), regex, string, and user-defined methods to captilize the first letter of a string. How to Truncate Float in PythonThis tutorial explains how to truncate a float in Python.