Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get first letter of each word in string python

def abbrevName(name):
    xs = (name)
    name_list = xs.split()
    # print(name_list)

    first = name_list[0][0]
    second = name_list[1][0]

    return(first.upper() + "." + second.upper())
answer = abbrevName("Ozzie Smith")
print(answer) 
Comment

grab the first letter of each string in an array python

def firstLetterOfEachName():
	names = ["Kevin", "Cameron", "Liam", "Meghan"]
	firstLetter = [x[0] for x in names]
    return firstLetter

answer = firstLetterOfEachName()
print(answer)
Comment

PREVIOUS NEXT
Code Example
Python :: python write error to file 
Python :: mro in python 
Python :: show chrome devtools in selenium 
Python :: pandas explode 
Python :: ajouter dans une liste python 
Python :: python launch prompt 
Python :: prettify json in pycharm 
Python :: # Import KNeighborsClassifier from sklearn.neighbors 
Python :: install python cap 
Python :: == in python 
Python :: nested python list 
Python :: how to convert r to python 
Python :: min() and max() Function in python 
Python :: call methods from within a class 
Python :: skeppy python 
Python :: printing with format 
Python :: print backwards python 
Python :: how to get the user argent in django 
Python :: exchange sort python 
Python :: py to flag converter online 
Python :: ID number zero python 
Python :: forgot password miguel grinberg 
Python :: mad libs game prompt python 
Shell :: set git editor to vim 
Shell :: kill all server 5000 mac 
Shell :: Zsh is not installed. Please install zsh first. 
Shell :: apache2.service is not active cannot reload. ubuntu 
Shell :: ubuntu settings missing 
Shell :: linux set date timezone 
Shell :: conda install openpyxl 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =