0% found this document useful (0 votes)
13 views2 pages

Python String Operations Definitions

The document provides definitions for various Python string operations, including methods like replace(), append, upper(), lower(), split(), isalnum(), isalpha(), isdigit(), type(), center(), len(), and count(). Each method is briefly explained, detailing its functionality and usage in manipulating strings. These operations cover string modification, character checks, and formatting.

Uploaded by

saipreethi8050
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Python String Operations Definitions

The document provides definitions for various Python string operations, including methods like replace(), append, upper(), lower(), split(), isalnum(), isalpha(), isdigit(), type(), center(), len(), and count(). Each method is briefly explained, detailing its functionality and usage in manipulating strings. These operations cover string modification, character checks, and formatting.

Uploaded by

saipreethi8050
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python String Operations - Definitions

[Link]()
Replaces a specified substring with another substring in a string and returns a new modified string.

string append
Appending means adding one string to the end of another string. In Python, this is commonly done
using the + operator.

upper()
Converts all characters in a string to uppercase letters.

lower()
Converts all characters in a string to lowercase letters.

split()
Splits a string into a list of substrings based on a specified separator. If no separator is given, it
splits by spaces.

isalnum()
Returns True if all characters in the string are alphanumeric (letters or numbers) and the string is
not empty.

isalpha()
Returns True if all characters in the string are alphabetic letters and the string is not empty.

isdigit()
Returns True if all characters in the string are digits (numbers) and the string is not empty.

type()
Returns the data type of a variable or value.

center()
Aligns the string in the center of a specified width by adding padding (usually spaces) on both sides.

len()
Returns the total number of characters present in a string.
count()
Returns the number of times a specified substring appears in a string.

You might also like