Python String swapcase() Method Example

Python String swapcase() Method Example

Python string swapcase() is an inbuilt string handling method that is used to change the case of the string. It changed to lowercase letters and vice versa.

Python string swapcase() is an inbuilt string handling method that is used to change the case of the string. The swapcase() method returns the string where all the uppercase letters are changed to lowercase letters and vice versa. The swapcase() method returns the string where all the upper case letters are lower case and vice versa.

Python String swapcase()

See the following syntax.

string.swapcase()

Here string is the string variable that holds the input string on which swapcase() method is applied.

The swapcase() method doesn’t take any parameters.

See the following code example.

## app.py

h1= “Hello boY”
h1.swapcase()

python python string swapcase swapcase

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Python Strings Tutorial - How To Use Strings In Python

This Edureka video on 'Python Strings' will help you...

String methods in Python

String methods in Python - Python Strings

Python f-strings - The Ultimate Usage Guide

Python f-strings are the fastest string formatting option available on Python. It is robust, easy to read, concise and less prone to errors. If you are using Python 3.6+, you must switch to Python f-strings. In this detailed guide, we have covered...

Python Tricks Every Developer Should Know

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

How to Remove all Duplicate Files on your Drive via Python

Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.