Python String capitalize() MethodPython capitalize() method converts first character of the string into uppercase without altering the whole string. It changes the first character only and skips rest of the string unchanged. SignatureParametersNo parameter is required. Return TypeIt returns a modified string. Python String Capitalize() Method Example 1Output: Old value: javatpoint New value: Javatpoint Python String Capitalize() Method Example 2What if first character already exist in uppercase. Output: Old value: Javatpoint New value: Javatpoint It returns the same string without any alteration. Python String Capitalize() Method Example 3What if first character is a digit or non-alphabet character? This method does not alter character if it is other than a string character. Output: Old value: #javatpoint New value: #javatpoint --------digit--------- Old value: 1-javatpoint New value: 1-javatpoint Next TopicPython Strings |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India