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
|
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week