Pythonで英字の大文字・小文字を区別せずに比較する方法のサンプルコードを以下に記します。
lower, upper, 正規表現のreモジュールを使ったサンプルコードです。
import re
a = "HELLO WORLD"
b = "hello world"
if a == b:
print "same stringl\n"
if a.upper() == b.upper():
print "upper() : same string"
if a.lower() == b.lower():
print "lower() : same string"
if re.compile(a,re.IGNORECASE).match(b) != None:
print "re.cmpile... : same string"
実際に実行した時の出力です。
$ python cmp.py upper() : same string lower() : same string re.cmpile... : same string
以上、Pythonで英字の大文字・小文字を区別せずに比較する方法でした。