Python String capitalize() Method5 Sept 2024 | 1 min read 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. 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 |
Python String Method Python method returns True if all the characters in the string are digits. It returns False if no character is digit in the string. Signature Parameters No parameter is required. Return It returns either True or False. Let's see some examples of method to understand it's functionalities. Python...
1 min read
Python String startswith() Method Python startswith() method returns either True or False. It returns True if the string starts with the prefix, otherwise False. It takes two parameters start and end. Start is a starting index from where searching starts and end index is where searching stops. Signature startswith(prefix[,...
2 min read
Python String Encode() Method Python method encodes the string according to the provided encoding standard. By default Python strings are in unicode form but can be encoded to other standards also. Encoding is a process of converting text from one standard code to another. Signature encode(encoding="utf-8", errors="strict") Parameters encoding : encoding...
2 min read
Python String rindex() Method Python rindex() method works same as the rfind() method except it throws error ValueError. This method throws an exception ValueError if the substring is not found. The syntax is given below. Signature rindex(sub[, start[, end]]) Parameters sub : substring to be searched. start (optional) : starting index to...
1 min read
Python String rsplit() Method Python rsplit() method seperates the string and returns a list. It splits from the right using seperator as a delimiter. If seperator is not specified, any whitespace string is a separator. This method does same as split() except splitting from the right which...
2 min read
Python String expandtabs() Method Python expandstabs() method replaces all the characters by sepecified spaces. By default a single tab expands to 8 spaces which can be overridden according to the requirement. We can pass 1, 2, 4 and more to the method which will replace tab by the...
1 min read
Python String Casefold() Method Python Casefold() method returns a lowercase copy of the string. It is more simillar to lowercase method except it revomes all case distinctions present in the string. For example in German, 'β' is equivelent to "ss". Since it is already in lowercase, lowercase do...
1 min read
Python String Method Python method returns True if the string is a titlecased string. Otherwise returns False. Signature Parameters No parameter is required. Return It returns either True or False. Let's see some examples of method to understand it's functionalities. Python String Method Example 1 It is a simple example to...
1 min read
Python String Count() Method It returns the number of occurences of substring in the specified range. It takes three parameters, first is a substring, second a start index and third is last index of the range. Start and end both are optional whereas substring is required. Signature count(sub[, start[,...
1 min read
Python String Method Python method returns a copy of the string after converting all the characters into lowercase. Signature Parameters No parameter. Return It returns a lowercase string. Let's see some examples of method to understand it's functionalities. Python String Method Example 1 See a simple example in which string is...
1 min read
We request you to subscribe our newsletter for upcoming updates.
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