Python String capitalize() Method
Python 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.
No parameter is required.
It returns a modified string.
Python String Capitalize() Method Example 1
Old value: javatpoint New value: Javatpoint
Python String Capitalize() Method Example 2
What if first character already exist in uppercase.
Old value: Javatpoint New value: Javatpoint
It returns the same string without any alteration.
Python String Capitalize() Method Example 3
What if first character is a digit or non-alphabet character? This method does not alter character if it is other than a string character.
Old value: #javatpoint New value: #javatpoint --------digit--------- Old value: 1-javatpoint New value: 1-javatpoint
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