0% found this document useful (0 votes)
4 views1 page

String Methods

The document outlines commonly used string methods in Python, demonstrating various operations on the string 'I am very happy'. It includes methods for changing case, checking character types, and finding occurrences of characters. The examples illustrate how to manipulate and analyze strings effectively.

Uploaded by

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

String Methods

The document outlines commonly used string methods in Python, demonstrating various operations on the string 'I am very happy'. It includes methods for changing case, checking character types, and finding occurrences of characters. The examples illustrate how to manipulate and analyze strings effectively.

Uploaded by

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

String Methods

1. Commonly Used String Methods –

dist = "I am very happy"

print(dist) # Original string


print(type(dist)) # Type of variable
print(len(dist)) # Total characters (including spaces)

print([Link]()) # All uppercase


print([Link]()) # All lowercase
print([Link]()) # First character capital
print([Link]()) # Title case

print([Link]()) # Checks if all lowercase


print([Link]()) # Checks if all uppercase
print([Link]()) # Checks if title case

print([Link]()) # Checks if all numeric


print([Link]()) # Only alphabets, no spaces
print([Link]()) # Alphabets + Numbers only (no spaces/symbols)
print([Link]()) # Only whitespace

print([Link]('a')) # First occurrence of 'a'


print([Link]('y')) # Last occurrence of 'y'
print([Link]('e')) # Count of 'e'

You might also like