How to make all words to lower case in python

This recipe helps you make all words to lower case in python using lower function

Recipe Objective

In Content Analysis or text Analysis we want same format of our text or content for better analysis and to get a better output, for e.g No special characters should be there, All the text should be in same case (Upper or lower). So now we are going to see how to make all words to lower case in a text.

Getting Started with Image Segmentation using Mask R-CNN

Step 1 - Take a Simple word and store it in a variable

My_word = "LANGUAGE" print(My_word)

LANGUAGE

So here we have taken a word, and stored it in a variable called My_word. As we can see the word is in Upper case so lets try to make it in lower case.

Step 2 - Converting upper case word to lower case

print("The lower case word is :",My_word.lower())

The lower case word is : language

here we can see the word has totally been converted into lower case, python has a inbuilt function called lower which converts the Upper case letters to lower case.

Step 3 - Lets try with a sentence

My_sentence = "Harry is 12 YEARS OLD, and he LOVES to Play 'FOOTBALL'." print("Lets see what changes has happened :", My_sentence.lower())

Lets see what changes has happened : harry is 12 years old, and he loves to play 'football'.

As we can see that, the letters which were in upper case has been converted into lower case though some words like football was in quotes still has been converted into lower case.

What Users are saying..

profile image

Anand Kumpatla

Sr Data Scientist @ Doubleslash Software Solutions Pvt Ltd
linkedin profile url

ProjectPro is a unique platform and helps many people in the industry to solve real-life problems with a step-by-step walkthrough of projects. A platform with some fantastic resources to gain... Read More

Relevant Projects

NLP Project on LDA Topic Modelling Python using RACE Dataset
Use the RACE dataset to extract a dominant topic from each document and perform LDA topic modeling in python.

Build a Music Recommendation Algorithm using KKBox's Dataset
Music Recommendation Project using Machine Learning - Use the KKBox dataset to predict the chances of a user listening to a song again after their very first noticeable listening event.

Time Series Analysis with Facebook Prophet Python and Cesium
Time Series Analysis Project - Use the Facebook Prophet and Cesium Open Source Library for Time Series Forecasting in Python

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

Deploying Machine Learning Models with Flask for Beginners
In this MLOps on GCP project you will learn to deploy a sales forecasting ML Model using Flask.

Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Build a Graph Based Recommendation System in Python-Part 2
In this Graph Based Recommender System Project, you will build a recommender system project for eCommerce platforms and learn to use FAISS for efficient similarity search.

Build an AI Chatbot from Scratch using Keras Sequential Model
In this NLP Project, you will learn how to build an AI Chatbot from Scratch using Keras Sequential Model.

Digit Recognition using CNN for MNIST Dataset in Python
In this deep learning project, you will build a convolutional neural network using MNIST dataset for handwritten digit recognition.