case-insensitive

How do I do a case-insensitive string comparison?

How do I do a case-insensitive string comparison? Question: How can I compare strings in a case insensitive way in Python? I would like to encapsulate comparison of a regular strings to a repository string, using simple and Pythonic code. I also would like to have ability to look up values in a dict hashed …

Total answers: 15

Ignore case in Python strings

Ignore case in Python strings Question: What is the easiest way to compare strings in Python, ignoring case? Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads). I guess I’m looking for an equivalent to C’s stricmp(). [Some more context requested, so I’ll …

Total answers: 16