Python Tutorial

Monday, May 6, 2013

Python string title - auto capitalize first character of the word

Python auto capitalize first character of all the word/words in a string.
s1 = "life is very easy with python"
s2 = "python"
print s1
print s1.title()

print s2
print s2.title()

Output:
life is very easy with python
Life Is Very Easy With Python
python
Python

0 comments:

Post a Comment