• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Case Converter Logo 60

EasyCaseConverter

Online Case Converter Tools

  • Home
  • Blog
  • About Us
  • Contact Us
  • Privacy Policy

Change Case to Lowercase and Uppercase in Python

August 4, 2020 by adminecc Leave a Comment

This article explains how to change case to lowercase and uppercase in python.

Python has a built-in method related to string handling.

You are not only can check whether the string is lowercase or uppercase, but you also can change a string to one of these case characteristics.

In this article, we will explain four of python’s built-in methods to check and change the string.

isupper()

isupper() is a built-in method used to check if the argument contains any uppercase characters such as ABCDEFGHIJKLMNOPQRSTUVWXYZ.

The following python code is an example of the use of isupper() method:

str = 'UPPERCASE'
print(str.isupper())

str = 'Some UPPER'
print(str.isupper())

Output:
True
False

isupper() method does not take any parameters. It returns True if all characters in the string are uppercase, and it returns False if the string contains one or more non-uppercase characters.

islower()

opposite to isupper() method, islower() method used to check if the argument contains any lowercase characters such as abcdefghijklmnopqrstuvwxyz.

The following python code is an example of the use of islower() method:

str = 'lowercase'
print(str.islower())

str = 'Some lower'
print(str.islower())

Output:
True
False

islower() method does not take any parameters. It returns True if all characters in the string are lowercase, and it returns False if the string contains one or more non-lower characters.

Both, isupper() and islower() methods will return True for whitespace, digits, and symbols

To convert a string to lowercase and uppercase, we can use lower() and upper() method respectively.

Lowercase and Uppercase in Python

lower()

lower() is a built-in method used to converts all uppercase characters to lowercase. It will return the original string if there are no uppercase characters.

The following python code is an example of the use of lower() method:

str = 'UPPERTOLOWER'
print(str.lower()) 
  
str = 'UpPer 123 ? lower'
print(str.lower()) 

Output:
uppertolower
upper 123 ? lower

upper()

upper() is a built-in method used to converts all lowercase characters to uppercase. It will return the original string if there are no lowercase characters.

The following python code is an example of the use of upper() method:

str = 'lowertoupper'
print(str.upper()) 
  
str = 'lower 123 ? UpPer'
print(str.upper())

Output:
LOWERTOUPPER
LOWER 123 ? UPPER

As shown in the example, both lower() and upper() method does not take any arguments, and it will return digits and symbols as it is.

Related posts:

Change Case to Lowercase and Uppercase in Javascript Easy Case Converter - Lowercase UppercaseUppercase to Lowercase Converter

Powered by YARPP.

Filed Under: article Tagged With: in python, islower(), isupper(), lower(), lowercase, upper(), uppercase

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Easy Case Converter Tool
Easy Case Converter - Free Case Converter Tools

Easy Case Converter, Free Online Case Converter Tools

Easy Case Converter is a free online converter case tools to convert your text into any formatted case.

Change Case to Lowercase and Uppercase in Javascript

This article explains how to change case to lowercase and uppercase in Javascript. Javascript has two methods to change a string to lowercase and uppercase, called toLowerCase() and toUpperCase(), respectively. The toLowerCase() The toLowerCase() is a built-in method that returns the calling string value converted to lowercase. The following Javascript code is an example of […]

Change Case to Lowercase and Uppercase in Python

This article explains how to change case to lowercase and uppercase in python. Python has a built-in method related to string handling. You are not only can check whether the string is lowercase or uppercase, but you also can change a string to one of these case characteristics. In this article, we will explain four […]

How to Change Case in Excel?

In the previous article, we discuss how to change Case in Word. But this article, we will explain how to Change Case in Excel. For your information, in this article, we use Microsoft Excel from Office 356. Different from Microsoft Word, to change sentence case, we can do easily by using the Font Options or […]

Copyright © 2019 EasyCaseConverter.com