Jan-08-2023, 02:58 PM
just cast both strings to lower (or upper) then compare:
example:
example:
>>> city1 = 'WASHINGTON D.C.' >>> city2 = 'Washington D.C.' >>> >>> # without changing case: >>> city1 == city2 False >>> >>> # with case change: >>> city1.lower() == city2.lower() True >>> >>> # original variable names remain as they were: >>> city1 'WASHINGTON D.C.' >>> city2 'Washington D.C.' >>>