Print First Letter of Each Word Using Regex in Python

Rohan Singh
Updated on 11-Jul-2023 14:28:13

3K+ Views

Regex library in Python is used for pattern matching and manipulation of text data. We can print the first letter of each word using regex by identifying a new word after spaces using its pattern-matching functionality. In this article, we will implement a program to print the first letter of each word using regex. Regular Expressions Regular expression or regex is a tool for pattern matching in text. They are a sequence of characters that define a search pattern. They are widely used in programming, particularly in text processing, and are supported by most programming languages, including Python. Printing ... Read More

Determine Unicode Code Point at Given Index in Python

Rohan Singh
Updated on 11-Jul-2023 14:21:54

4K+ Views

A Unicode code point is a unique number that represents a number in the Unicode character set. Unicode is a character encoding standard that is used to assign unique codes to every character in the world. Unicode supports around 130, 000 characters including letters, symbols, and emojis.We can determine the Unicode Code point at a specific index using the ord() function, codecs module in Python, unicodedata module, and array module in Python. In this article, we will discuss how we can determine the Unicode code point at a given index using all these methods. Unicode Code Point According to ... Read More

Compare Two Strings Lexicographically in Python

Rohan Singh
Updated on 11-Jul-2023 14:19:53

5K+ Views

We can compare two strings lexicographically in Python using comparison operators like '', '==', ' string2[i]: print(string2, "comes before", string1) break i += 1 else: if len(string1) < len(string2): print(string1, "comes before", string2) elif len(string1) > len(string2): print(string2, "comes before", string1) else: print("The two strings are equal") Output apple comes before banana Example In the below ... Read More

Save Pandas DataFrame as Gzip Zip File

Rohan Singh
Updated on 11-Jul-2023 14:16:35

7K+ Views

Pandas dataframe can be saved in gzip/zip format using the gzip and zipfile module in Python. Pandas is a Python library that is used for data manipulation and analysis. It provides a two-dimensional labeled data structure with columns of potentially different data types. To reduce the size of the data frame we need to store it in gzip/zip format. In this article, we will understand how we can save Pandas Dataframe as gzip/zip file. Algorithm A generalized algorithm to save a Pandas DataFrame as a compressed gzip/zip file is written below. However, the exact implementation of this algorithm may vary ... Read More

Check If All Rows of a Matrix Are Circular Rotations of Each Other

Prabhdeep Singh
Updated on 11-Jul-2023 14:14:22

212 Views

Matrix consists of rows and columns to form a rectangular array. And circular rotations mean rotating the array's elements so that one rotation places the last element in the first position and the rest of the elements to the right. In this problem, we have given a matrix of n * n, and our task is to check if all rows of a matrix are circular rotations of each other then print “YES” otherwise print “NO”. Let's see examples with explanations below to understand the problem in a better way. Input 1 mat = [ [ 1, 5, 6], ... Read More

Convert Roman Numerals to Decimal (1 to 3999) in Java

Prabhdeep Singh
Updated on 11-Jul-2023 14:05:25

657 Views

The characters used in an arrangement of number notation based on the pre-Roman Roman system is called Roman numerals. The letters M, D, C, L, X, V, and I stand for 1000, 500, 1000, 50, 10, 5, and 1, respectively, and will discuss all main symbols in the below section. In this problem, we are given a string of Roman numerals and our task is to convert Roman numerals to decimals in the range of 1 to 3999. Let’s see examples with explanations below to understand the problem in a better way. Input 1 str = "MCMIX" Output 1 1909 ... Read More

Save Numpy Array to Text File

Rohan Singh
Updated on 11-Jul-2023 13:57:37

23K+ Views

The Numpy array can be saved to a text file using various methods like the savetxt() method, save() method, and dataframe.to_csv() function. Numpy is a Python library that is used to do the numerical computation, manipulate arrays, etc. In this article, we will discuss the methods that can be used to save a numpy array to a text file. Method 1: Using the numpy.savetxt() function The numpy.savetxt() function simply saves the numpy array to a text file. The function takes two arguments - the file name in which the numpy array is to be saved and the array itself. ... Read More

Run Python Flask App Online Using Ngrok

Rohan Singh
Updated on 11-Jul-2023 13:54:17

6K+ Views

Ngrok is a tool that is used to create a secure tunnel between your local machine and the internet. It is used to test the web application and allows developers to expose their local web server to the internet without having to deploy it to a remote server. Python Flask allows you to create web applications locally but we might want to showcase it to the world by running it online. In this article, we will use the Ngrok tool to run the web application online without hosting it on any server. The Steps to Run Python Flask App Online ... Read More

Run Multiple Python Files in a Folder One After Another

Rohan Singh
Updated on 11-Jul-2023 13:52:19

12K+ Views

The subprocess module can be used to run multiple Python files in a folder one after another. Running multiple files one after another is required in various situations like when processing large data sets or performing complex analysis. In this article, we will discuss the steps involved in running multiple Python files in a folder sequentially with examples. Method 1: Using the subprocess() method Steps for creating and running multiple Python files sequentially Step 1: Create multiple Python files to run We need to have three Python files in a folder to run them sequentially. So the first step ... Read More

Google Translate Alternatives

Shirjeel Yunus
Updated on 11-Jul-2023 13:49:19

533 Views

What is Google Translate? Google Translate is a tool from Google which can translate a text into more than 100 languages. The tool is being used by millions of people and it has been estimated that more than 100 billion words are translated per day as per statistics. The app can be used as a website on any browser. A mobile app is also available which can be installed on Android and iOS devices. Why Google Translate Alternatives? There are a few disadvantages of Google Translate which can be found in the list below: The meaning of the source ... Read More

Advertisements