Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a way to convert a string from uppercase, or even part uppercase to lowercase?

(有没有一种方法可以将字符串从大写字母甚至部分大写字母转换为小写字母?)

For example, "Kilometers" → "kilometers".

(例如,“公里”→“公里”。)

  ask by Benjamin Didur translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
148 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use .lower() - For example:

(使用.lower() -例如:)

s = "Kilometer"
print(s.lower())

The official 2.x documentation is here: str.lower()

(官方2.x文档在这里: str.lower())
The official 3.x documentation is here: str.lower()

(正式的3.x文档在这里: str.lower())


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...