Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

how to capitalize first letter in python in list using list comprehension

my_list = ['apple pie', 'orange jam']
print my_list[0].capitalize()
Comment

capiatlize first letter in list

    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
   
   Output:

   Johnny rotten, Eddie vedder, Kurt kobain, Chris cornell, Micheal phillips jagger
Comment

PREVIOUS NEXT
Code Example
Python :: find word position in string python 
Python :: docker flask 
Python :: pandas apply check for string length in column 
Python :: how to separate url from text in python 
Python :: pandas replace nan with value above 
Python :: reversed python 
Python :: Could not find a version that satisfies the requirement ckeditor 
Python :: spacy access vocabulary 
Python :: regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory 
Python :: roc auc score plotting 
Python :: python ord() 
Python :: no python application found, check your startup logs for errors 
Python :: check if string equals string in list python 
Python :: python send sigint to subprocess 
Python :: python add strings 
Python :: pip offline package install 
Python :: py to exe 
Python :: python key from values 
Python :: how to rename files python 
Python :: python how to add to a list 
Python :: python try else 
Python :: List Delete a Element 
Python :: python get last element of array 
Python :: save bool using playerprefs 
Python :: Python - How To Count Occurrences of a Character in a String 
Python :: lemmatization 
Python :: what is a class in python 
Python :: K-Means Clustering in Python – 3 clusters 
Python :: dataframe shift python 
Python :: compile python to exe bash 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =