- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 do I do a case insensitive string comparison in Python?
The following code is an example of case insensitive string comparison in Python.
Example
string1 = 'Star Wars' string2 = 'star wars' if string1.lower() == string2.lower(): print "The strings are case insensitive" else: print "The strings are not case insensitive"
Output
This code gives the following output
The strings are case insensitive
- Related Articles
- How do I make my string comparison case insensitive?
- How do we make my string comparison case insensitive in java?
- How to do case insensitive string comparison of strings in JavaScript
- Case-insensitive string comparison in C++
- How do I make case-insensitive queries on MongoDB?
- How to do case-sensitive string comparison in JavaScript?
- How do I modify a string in place in Python?
- How do I execute a string containing Python code in Python?
- How do I wrap a string in a file in Python?
- How do I convert a string to a number in Python?
- How do I convert a number to a string in Python?
- How do I un-escape a backslash-escaped string in Python?
- How do I format a string using a dictionary in Python 3?
- Case sensitive string comparison in Java.
- How can I search (case-insensitive) in a column using LIKE wildcard?

Advertisements