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
38 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
3,017 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,340 points
129 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,210 points
128 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,340 points
66 views
0 votes
1 answer
+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 509 views
0 votes
0 answers
+4 votes
6 answers
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
484 views