Comparing strings in Python

0 votes
How can I compare two strings in python regardless of their casing? Like, "Match" and "match" are actually the same words but one is capitalized. Please tell me how to ignore the casing during string comparsion.
May 28, 2018 in Python by newbie
843 views

1 answer to this question.

0 votes

Convert both the strings to either uppercase or lowercase and then perform the comparison.

if string1.lower() == string2.lower():
     #compare
answered May 28, 2018 by Nietzsche's daemon
• 4,260 points

Related Questions In Python

0 votes
1 answer

comparing strings in Python using "==" or "is"

is is used for identity testing and ...READ MORE

answered Sep 19, 2018 in Python by SDeb
• 13,300 points
823 views
0 votes
1 answer

Comparing two files contents in python

Considering your file "Unique.txt" does just containt the IP ...READ MORE

answered Sep 11, 2018 in Python by Priyaj
• 58,100 points
698 views
0 votes
1 answer

Comparing two files contents in python

Considering your file "Unique.txt" does just containt the IP ...READ MORE

answered Sep 20, 2018 in Python by Priyaj
• 58,100 points
14,894 views
0 votes
1 answer

Comparing two files contents in python

This code should work for you: It ...READ MORE

answered Sep 21, 2018 in Python by Priyaj
• 58,100 points
683 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,391 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,994 views
0 votes
1 answer

Reversing strings in Python

The fastest way to reverse string is ...READ MORE

answered May 7, 2018 in Python by Nietzsche's daemon
• 4,260 points
635 views
0 votes
1 answer

Sorting a list of strings in Python

Use the sort function mylist.sort() READ MORE

answered May 29, 2018 in Python by Nietzsche's daemon
• 4,260 points
633 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP