Python String capitalize() Method
Advertisements
Description
The method capitalize() returns a copy of the string with only its first character capitalized. For 8-bit strings, this method is locale-dependent.
Syntax
Following is the syntax for capitalize() method
str.capitalize()
Parameters
NA
Return Value
This method returns a copy of the string with only its first character capitalized.
Example
The following example shows the usage of capitalize() method.
#!/usr/bin/python str = "this is string example....wow!!!"; print "str.capitalize() : ", str.capitalize()
Let us compile and run the above program, this will produce the following result:
str.capitalize() : This is string example....wow!!!