공부
[Python] string to lowercase & case insensitive comparison
승가비
2020. 4. 11. 19:29
728x90
s = "Kilometer"
print(s.lower())
string1 = 'Hello'
string2 = 'hello'
if string1.lower() == string2.lower():
print("The strings are the same (case insensitive)")
else:
print("The strings are NOT the same (case insensitive)")
https://stackoverflow.com/questions/6797984/how-do-i-lowercase-a-string-in-python
How do I lowercase a string in Python?
Is there a way to convert a string from uppercase, or even part uppercase to lowercase? For example, "Kilometers" → "kilometers".
stackoverflow.com
https://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison
How do I do a case-insensitive string comparison?
How can I do case insensitive string comparison in Python? I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and Pythonic way. I also would ...
stackoverflow.com
728x90