How to capitalize the first word of string?

0 votes
Hi. I have a list of string and but they are all in small case. The element are names so want to capitalize the first letter. How to do it?
Apr 4, 2019 in Python by Raj
66 views

1 answer to this question.

0 votes

Refer to the below command:

txt = "hello"
x = txt.capitalize()
print (x)

answered Apr 4, 2019 by Giri

Related Questions In Python

+1 vote
1 answer

How to print first character of each word in upper case of a string in Python

You can use split() using space as ...READ MORE

answered Jun 1, 2018 in Python by george
• 200 points
5,495 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by aryya
• 7,380 points
280 views
–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

answered Mar 29, 2019 in Python by rajesh
• 1,230 points
316 views
0 votes
1 answer

Replace First and Last Word of String in the Most Pythonic Way

import re a = " this is a ...READ MORE

answered Aug 22, 2018 in Python by aryya
• 7,380 points
415 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,449 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,084 views
0 votes
1 answer

How to check plural & singular form of a word?

You can try with the inflect 0.2.4 ...READ MORE

answered Jan 3, 2019 in Python by anonymous
1,402 views