

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to invert case for all letters in a string in Python?
String class has a method called swapcase() for swapping case of all letters. You can use it as follows:
>>> 'Hello World 123'.swapcase() 'hELLO wORLD 123' >>> 'Make America Great Again'.swapcase() 'mAKE aMERICA gREAT aGAIN'
- Related Questions & Answers
- How to check if a string contains only lower case letters in Python?
- How to check if a string contains only upper case letters in Python?
- How to convert all uppercase letters in string to lowercase in Python?
- Moving all Upper case letters to the end of the String using Java RegEx
- How to sort the letters in a string alphabetically in Python?
- For Hosts Locale how to convert a string to lowercase letters in JavaScript?
- How to generate random strings with upper case letters and digits in Python?
- How to convert lowercase letters in string to uppercase in Python?
- How can it be possible to invert a string in MySQL?
- For the Hosts Locale how to convert a string to uppercase letters in JavaScript?
- How to check if a string contains only whitespace letters in Python?
- Program to invert a binary tree in Python
- Python regex to find sequences of one upper case letter followed by lower case letters
- How to move all capital letters to the beginning of the string in JavaScript?
- How can we print all the capital letters of a given string in Java?
Advertisements