티스토리 뷰

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

'공부' 카테고리의 다른 글

[Python] ModuleNotFoundError: No module named  (0) 2020.04.12
[Linux] vi show & hide line number  (0) 2020.04.12
[Linux] check disk size  (0) 2020.04.11
[Linux] check memory  (0) 2020.04.11
[Linux] set default editor  (0) 2020.04.11
댓글