Thursday, March 29, 2018

How to capitalize a string in Python 3 ?


String capitalize( ) Method

It returns a copy of the string with only its first character capitalized.

Syntax

str.capitalize()


Return Value
     string

Example


#!/usr/bin/python3
str = "this is string example....wow!!!"

print ("str.capitalize() : ", str.capitalize())

Result

str.capitalize() : This is string example....wow!!!



<<< Unicode Strings                    Go to Index                center( ) >>>