Tuesday, November 27, 2018

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".


Answer



Use .lower() - For example:



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


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


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...