OCJP

String Functions in Python

In python there are so many inbuild functions for String Operations. All the functions returns new values. They do not change the original values which is passed as a parameter.

capitalize() :

This function capitalize the first letter of the sentencs.

eg.

s1="hello How are you today. good morning"
s2= s1.capitalize()
print(s1)
print(s2)

s1="HELLO HOW ARE YOU ?"
print(s1)
print(s2)

Output

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?