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
44 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,160 points
32 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
• 56,520 points
31 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
• 56,520 points
556 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
• 56,520 points
36 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 233 views
+4 votes
6 answers
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
37 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
35 views