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

Bigrams in PythonA bigram is a pair of adjacent words in a text, while a trigram is a triplet of adjacent words. Bigrams and trigrams are commonly used in text analysis and natural language processing tasks, such as word segmentation, part-of-speech tagging, and text generation. How to One Line FTP Server in PythonThis tutorial demonstrates how to create one line FTP server in Python. How to Lock a File in PythonThis article explains why locking a file in Python is important. This discusses examples of what happens when two processes interact with a shared resource without a lock, why knowing the file state is important before placing a lock, and some widely used lockers. How to Generate Password in PythonIn this article, we discussed the two modules, i.e., Secrets and Random modules, that help us to generate passwords in Python. Both modules have a similar function to generate random numbers, but the Secrets module generates relatively strong cryptographic random passwords which are difficult to crack and hard to remember. How to Check Argument of Argparse in PythonOne can check if an argument exists in argparse using a conditional statement and the name of the argument in Python. How to Execute Python Script via CrontabThis tutorial demonstrates to execute a Python script via Crontab. How to Make an API Call With Token in PythonIn this tutorial, we want to learn what an API is and how we can call them in Python. How to Convert PDF to Text in PythonIn this tutorial, we will learn how to use Python to convert a PDF document into a text file using PyPDF2, Aspose, and PDFminer. How to Set User Agent Using Requests in PythonThis article explains concepts like HTTP headers, getting user agent data, and setting user agent using requests. Every section is provided with an appropriate Python program to aid in understanding the concepts. How to Implement Series of Promises in PythonGuide to implement series of promises in Python. How to Ignore SSL Security Certificate Check in Python RequestsThis article explains issues regarding expired SSL certificates, and how to resolve them. It explains two major ways to disable the security checks, which are either monkey patching the system library requests or using another library package urllib3 to disable them. How to Create Temporary File in PythonThis article explains four sub-functions of the tempfile library function: TemporaryFile, NamedTemporaryFile, mkstemp, and TemporaryDirectory. Appropriate programs are provided in each section to ease the understanding of the concepts. How to Unset a Linux Environment Variable in PythonThis article demonstrates how to unset a Linux environment variable in Python. How to Read and Write to Parquet Files in PythonThe article explains reading and writing parquet files in Python using two interfaces: pyarrow and fastparquet. Relevant coding examples are provided for sub-sections like reading tables and multiple and single columns. How to List Serial Ports Using PythonThis article thoroughly explains how to use Python to get the list of serial ports and their data. How to Use Circular List in PythonThis article describes using a circular list in Python. How to Set Logging Levels Using setLevel() in PythonThis article explains logging in Python. The different levels of the log messages and how they are set using the setLevel are explained in great detail in this article. How to Parse ISO 8601 Date in PythonThis tutorial explains how to parse typical DateTime format to ISO 8601 in Python. How to Install Egg File in PythonThis tutorial describes how to install .egg file in Python and the tools required to achieve the operation. How to Create Defaultdict of Defaultdict in PythonIn Python, Defaultdict is good for handling key errors, and this article explains how to create defaultdict of defaultdict. How to Check if Element Exists Using Selenium PythonThis tutorial describes checking if an HTML element exists using the Selenium Python package. How to Change File Permissions in PythonThis article will discuss how to change file permissions in Python. The @ Symbol in PythonThis tutorial will teach you to use @ symbol in Python. How to Run Python in Java Using JythonThis article covers a detailed explanation of how to use Jython to create java programs that support python codes. The article covers all prerequisites like downloading Jython, linking it with an IDE, and writing the java program that can read python codes. Three distinct python codes are prepared that are tested inside Java program and the output is documented.