Python Articles

Page 190 of 854

Create Word Cloud using Python

Akshitha Mote
Akshitha Mote
Updated on 23-Jun-2025 2K+ Views

A "word cloud" is a visual representation of text data, where the size of each word indicates its frequency or importance within the dataset. It helps us to identify the most common and important words in a text. It is typically used to describe/denote big data in a word. In this article, we will create a word cloud on the Python programming language, and the data is accessed from Wikipedia. Modules to create a Word Cloud in Python Following are the modules required to create a word cloud in Python : Install wordcloud Before installing the word cloud module, you have ...

Read More

How to convert HTML to PDF using Python

Akshitha Mote
Akshitha Mote
Updated on 23-Jun-2025 2K+ Views

In general, we look at some external websites to convert our files to PDF format; instead, we can convert them using Python on our own. In this article, we will understand the steps to convert the HTML (Hyper Text Markup Language) to PDF using Python code. Steps to convert HTML to PDF Following are the steps to convert the HTML file to PDF using Python: Step 1: Installation Download the pdfkit library by running the following command in the command prompt: pip install pdfkit Step 2: Download wkhtmltopdf Following are the steps to download wkhtmltopdf: ...

Read More

Add Two Numbers in Python

gireesha Devara
gireesha Devara
Updated on 20-Jun-2025 3K+ Views

Adding two numbers in Python is one of the most basic tasks, where we need to combine their values to get a total. In this article, we will see different ways to add two numbers in Python. Using Arithmetic Operator To add two numerical values in Python, we can use the addition operation, represented by the "+" symbol. It is one of the arithmetic operators in Python that performs the addition operation. Example Here is the basic example that adds the two numbers using the addition operator (+). # Assign values to the variables a = 7 b = ...

Read More

Check if both halves of the string have same set of characters in Python

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 384 Views

In Python, a string is one of the data structures that is a sequence of characters enclosed within single quotes '' or double quotes "". It is immutable, i.e., once a string is created, it cannot be changed. When we want to check if both halves of the string have the same set of characters in Python, we can follow the steps below - First, based on the length of the string, we have to split the string into two halves. Next, convert each half into a set of characters using set() function. Finally, compare the two sets using ...

Read More

Basic calculator program using Python program

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 2K+ Views

In this tutorial, we are going to build a basic calculator in Python. As we all know that a calculator will give six options to the user from which they select one option and we will perform the respective operation. Following are the arithmetic operations that we can perform using a basic calculator - Addition Subtraction Multiplication Division Floor Division Modulo Steps in Developing the Basic Calculator Following are the steps involved in creating a basic calculator in Python - Defining Arithmetic Functions First, we are defining all the arithmetic operations that can be performed by using a ...

Read More

Generate two output strings depending upon occurrence of character in input string in Python

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 187 Views

In Python, a string is one of the data structures that is a sequence of characters enclosed within single quotes '' or double quotes "". It is immutable, i.e., once a string is created, it cannot be changed. When we want to generate two output strings based on character occurrence in Python, we have to follow the steps below - First, we need to initialize a dictionary or use the collections.Counter class to count the frequency of each character in the input string. Next, we have to go through the input ...

Read More

To print all elements in sorted order from row and column wise sorted matrix in Python

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 378 Views

In Python, we may go through the matrices that are sorted in a particular order. A common case is a matrix where each row and each column is sorted in increasing order, and this does not mean that the entire matrix is sorted. In such cases, we need to extract all elements and print them in a fully sorted order. Row and Column-wise Sorted Matrix? A row and column-wise sorted matrix means each row is sorted from left to right, and each column is sorted from top to bottom. For example, let's consider the following matrix - matrix = ...

Read More

How to copy a file to a remote server in Python using SCP or SSH?

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 17K+ Views

When we want to transfer files from our local system to a remote server securely, Python provides possible ways to do the file transfer using the Paramiko and SCP libraries. These libraries support SSH-based file transfer, which is secure and reliable. Installing Required Libraries Before we start with file transfer, we need to install all the required libraries with the help of below commands - pip install paramiko scp Using paramiko and SCP/SSH Paramiko is a third-party library available in Python, which is used to transfer a file to a remote server without using an external SCP module. This ...

Read More

How to perform different commands over ssh with Python?

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 2K+ Views

When we want to remotely access and execute commands on another machine then we use the paramiko library in Python. Paramiko is a third-party library that is used to connect and communicate securely with remote machines using the SSH, i.e., Secure Shell protocol. It allows us to execute commands, transfer files, and perform other remote tasks programmatically. To use the Paramiko library, first we need to install it in our local system using the below command - pip install paramiko Example Following is the example, in which we connect to a remote server via SSH and perform multiple shell ...

Read More

How to print Python dictionary into JSON format?

Niharikaa Aitam
Niharikaa Aitam
Updated on 20-Jun-2025 8K+ Views

In Python, Dictionaries are used to store structured data. When we want to print this data in a human-readable format or transfer it through the internet, such as to an API, then we need to convert the dictionary to JSON, i.e., JavaScript Object Notation. Python has a built-in module named json to handle such conversions. JSON is JavaScript Object Notation which is a lightweight text-based open standard designed for human-readable data interchange. The JSON format was specified by Douglas Crockford. It has been extended from the JavaScript scripting language. A dictionary in Python is a mutable and unordered collection ...

Read More
Showing 1891–1900 of 8,532 articles
« Prev 1 188 189 190 191 192 854 Next »
Advertisements