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
710 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

0 votes
1 answer

How can I capitalize the first letter of each word in a string?

By using  the .title() method of string ...READ MORE

answered Feb 17, 2022 in Python by Dev
• 6,000 points
663 views
0 votes
1 answer

How can I capitalize the first letter of each word in a string?

The .title() method of a string (either ASCII or ...READ MORE

answered Feb 18, 2022 in Python by CoolCoder
• 4,420 points
488 views
+1 vote
2 answers

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

class Solution:     def firstAlphabet(self, s):             self.s=s              k=''              k=k+s[0]              for i in range(len(s)):                     if ...READ MORE

answered Oct 28, 2020 in Python by Anurag
12,389 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,460 points
1,373 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 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,790 points
4,071 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
4,424 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP