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 Do Nothing Inside an if Statement in PythonIn this article, you will learn how to skip writing some code inside the if-statement in Python. How to Create Random Seed Function in PythonThis tutorial demonstrates how does the random function work in Python with seed and without seed How to Convert UTC to CST in PythonThis tutorial discusses how to convert the date and time from UTC to CST in python How to Delete Element From List in PythonThis tutorial demonstrates how to remove an element from a list by value if it exists in the list How to Copy String in PythonThis tutorial discusses the different ways to to copy a string in Python. How to Read File Into Dictionary in PythonThis tutorial discusses how to read file into a dictionary in Python How to Find NTH Root of X Value in PythonThis tutorial demonstrates how to find the nth root of x value in Python. How to Convert String to Decimal in PythonThis tutorial discusses how to convert a string to a decimal number in Python How to Extend Python DictionaryThis article introduces how to concatenate a dictionary with another one using different methods in python How to Convert Datetime to Date in PythonThis tutorial discusses how to convert datetime to date in Python How to Make a Pascal's Triangle in PythonThis guide demonstrates how to make a Pascal Triangle in Python. How to Split Sentence Into Words in PythonThe str.split() function can be used to split a sentence into a list of words in Python. How to Remove Punctuation From Python ListWe can use the string.punctuation to remove punctuation signs from a list of strings in Python. How to Print % Sign in PythonWe can print the % sign by writing %% in the print() function of Python. How to Lock Thread in PythonThread lock is a mechanism for preventing any race condition. It can be used by creating an instance of the Lock class in Python. How to Find All Indexes of a Character in Python StringWe can use regular expressions, the yield keyword, and list comprehensions to find all the indexes of a character inside a string in Python. How to Execute a Script in PythonLearn how to execute a script in Python How to Calculate Dot Product in PythonThis tutorial discusses how to calculate the dot product of two arrays in Python How to Parse a Log File in PythonLearn how to parse a log file in Python How to Implement Gradient Descent Using NumPy and PythonLearn how to implement gradient descent using NumPy and Python How to Draw a Rectangle Using OpenCV Module in PythonLearn how to draw a rectangle using OpenCV module in Python How to Parse String to List in PythonThere are 4 main methods that can be used to parse a string representation of a list into an actual list, the str.split(), the str.strip(), the json.loads(), and the ast.literal_eval() functions. How to Find Files Using PythonWe can use the os library, the glob library, or the pathlib library to find a file in Python. How to Check if a Number Is Even or Odd in PythonWe can use the modulus operator % or the bitwise AND operator & to check whether a number is even or odd in Python.