capitalize first letter of each element in list python code example
Example 1: capitalize first letter of each word python
"hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
Example 2: how to capitalize the first letter in a list python
singers = ['johnny rotten', 'eddie vedder', 'kurt kobain', 'chris cornell', 'micheal phillip jagger']
singers = [singer.capitalize() for singer in singers]
print(singers)
#instead of capitalize use title() to have each word start with capital letter