[Go to site: main page, start]

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

Python Inbuilt String Functions

This document provides an overview of various Python inbuilt string functions, including examples for each function. Key functions covered include upper(), lower(), title(), capitalize(), isalpha(), isdigit(), isalnum(), find(), replace(), startswith(), and endswith(). Each function is explained with its purpose and a sample code snippet demonstrating its usage.

Uploaded by

javahost07
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)
7 views2 pages

Python Inbuilt String Functions

This document provides an overview of various Python inbuilt string functions, including examples for each function. Key functions covered include upper(), lower(), title(), capitalize(), isalpha(), isdigit(), isalnum(), find(), replace(), startswith(), and endswith(). Each function is explained with its purpose and a sample code snippet demonstrating its usage.

Uploaded by

javahost07
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 Inbuilt String Functions - Notes

upper()
Converts string to uppercase.
name = "vaish"
print([Link]())
# Output: VAISH

lower()
Converts string to lowercase.
name = "VAISH"
print([Link]())
# Output: vaish

title()
Converts first letter of each word to uppercase.
text = "python developer"
print([Link]())
# Output: Python Developer

capitalize()
Capitalizes first character of string.
text = "python"
print([Link]())
# Output: Python

isalpha()
Returns True if all characters are alphabets.
text = "python"
print([Link]())
# Output: True

isdigit()
Returns True if all characters are digits.
num = "12345"
print([Link]())
# Output: True

isalnum()
Returns True if string is alphanumeric.
text = "python123"
print([Link]())
# Output: True

find()
Returns index of substring.
text = "hello python"
print([Link]("python"))

replace()
Replaces substring with another.
text = "hello world"
print([Link]("world","python"))

startswith()
Checks if string starts with value.
text = "python class"
print([Link]("python"))

endswith()
Checks if string ends with value.
text = "[Link]"
print([Link](".py"))

You might also like