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

0 votes
value = 'the fat cat'

...do something here...

value should be:

'The Fat Cat'

How to do this in Python?

Feb 17 in Python by Nandini
• 5,480 points
25 views

1 answer to this question.

0 votes

By using  the .title() method of string we can get the first letter of every word capitalized

value = 'the fat cat'

value.title()

Output

'The Fat Cat'
answered Feb 17 by Dev
• 6,000 points

Related Questions In Python

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 in Python by CoolCoder
• 4,360 points
37 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
9,170 views
+2 votes
2 answers

In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

answered Apr 10, 2018 in Python by charlie_brown
• 7,710 points
596 views
0 votes
2 answers

How can I get the count of a list in Python?

n=[1,2,3,4,5,6,7,8,9] print(len(n)) =9 READ MORE

answered Dec 10, 2020 in Python by anonymous
612 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 2,756 views
0 votes
1 answer
0 votes
1 answer

How do I get the number of elements in a list

items = [] items.append("apple") items.append("orange") items.append("banana") len(items) #use the ...READ MORE

answered Feb 15 in Python by Dev
• 6,000 points
18 views
0 votes
2 answers

What's the difference between %s and %d in Python string formatting?

The reason is that they are using ...READ MORE

answered Feb 8 in Python by Rahul
• 8,980 points
25 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP