Block Websites Using Python in Windows

Recently I came up with an idea to block certain websites because I didn’t want my little brother to surf certain sites while he was using my laptop. Being a smart kid, he knew ways of uninstalling chrome extensions that I used to block websites. That is when I came up with the idea of … Read more

Receive Automated Email Notification on Website Update

Project Description This project is a demonstration of a live project on Upwork. We will replicate the entire process using a different URL. We will check for changes in the website after every hour and if there are changes to its content, we will immediately send an automated email to notify that the website has … Read more

Automate Backup to Google Drive with Python

Project Description Every day I find myself in a position where I have to take daily backup of a certain folder named Reports and store it in my Google drive. This is an essential folder for me since I store all the necessary documents (especially reports). Hence, keeping a backup of this folder in the … Read more

Python | Split String and Remove Last Element

🍎Summary: Split the string using rsplit with the specified separator and maxsplit as 1. This ensures the string is split from the right, and then you can extract the first value from this list which is the required output string. Minimal Example Problem Formulation 📜Problem: How will you split a string and eliminate the last … Read more

Python | Split String and Remove newline

Summary: The simplest way to split a string and remove the newline characters is to use a list comprehension with a if condition that eliminates the newline strings. Minimal Example Problem Formulation Problem: Say you use the split function to split a string on all occurrences of a certain pattern. If the pattern appears at the … Read more

Python | Split String and Keep Head and Tail

Summary: You can use the split() method to extract the head and tail elements from a given string. Minimal Example In the following articles, we have learned how to split a string and keep the first and last elements separately. In this article, you will learn how to get the first element and the last … Read more

Python | Split String until Character/Substring

Summary: You can use one of the following methods to split a string until a given character – Minimal Example Problem Formulation  📜Problem: Given a string. How will you split the string until a given character or substring? The output must only contain the substring until the given delimiter. Let’s visualize the problem with the … Read more

Python | Split Text into Sentences

✨Summary: There are four different ways to split a text into sentences:🚀 Using nltk module🚀 Using re.split()🚀 Using re.findall() 🚀 Using replace Minimal Example Problem Formulation Problem: Given a string/text containing numerous sentences; How will you split the string into sentences? Example: Let’s visualize the problem with the help of an example. Method 1: Using … Read more

Python | Split String with Regex

Summary: The different methods to split a string using regex are: Minimal Example Problem Formulation 📜Problem: Given a string and a delimiter. How will you split the string using the given delimiter using different functions from the regular expressions library? Example: In the following example, the given string has to be split using a hyphen … Read more

Python | Split String Parenthesis

🍎Summary: You can split a string at parenthesis using re.split(r'[()]’, text) in a list comprehension accordingly. Minimal Example Problem Formulation 📜Problem: Given a string. How will you split the string at parenthesis and spaces? Example In the above problem, you have been given a string separated by spaces and there are certain strings that are … Read more

How to Split a Multi-line String into Multiple Lines?

Summary: Use given_string.splitlines() to split a given multiline string into multiple lines. Minimal Example: Problem Formulation 📜Problem: Given a string, How will you split the string into a list of words using newline as a separator/delimiter? Example: Let’s dive into the different ways of solving the given problem. Method 1: Using splitlines Approach: The most convenient and … Read more