Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert upper case letters to lower case [duplicate]

Tags:

python

I have a script which reads the input and than lists it, however i want it to convert upper case letters to lower case, how can i do that?

this is what i got

 for words in text.readlines():     sentence = [w.strip(',.') for w in line.split() if w.strip(',.')]     list.append(sentence) 
like image 972
user998316 Avatar asked Oct 22 '11 19:10

user998316


People also ask

How do I convert caps to lowercase quickly?

To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.

How do you copy caps to lowercase?

Bonus Tip: Microsoft word also has a keyboard shortcut! Highlight the text you wish to modify then while holding down the Shift key tap the F3 key (tap it again to cycle through CAPITAL, lower case and Sentence case). It's that simple!

Can you automatically change caps to lowercase Excel?

Unlike Microsoft Word, Microsoft Excel doesn't have a Change Case button for changing capitalization. However, you can use the UPPER, LOWER, or PROPER functions to automatically change the case of existing text to uppercase, lowercase, or proper case.


2 Answers

You can find more methods and functions related to Python strings in section 5.6.1. String Methods of the documentation.

w.strip(',.').lower() 
like image 96
Ehtesh Choudhury Avatar answered Oct 17 '22 11:10

Ehtesh Choudhury


str.lower() converts all cased characters to lowercase.

like image 28
Dennis Avatar answered Oct 17 '22 10:10

Dennis