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

Essential String Functions in Python

The document lists various string functions in Python along with their descriptions and formats. Each function serves a specific purpose, such as determining string length, changing case, or checking character types. Examples of usage for each function are provided in the format 's1.function()' or 's1.function(arguments)'.

Uploaded by

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

Essential String Functions in Python

The document lists various string functions in Python along with their descriptions and formats. Each function serves a specific purpose, such as determining string length, changing case, or checking character types. Examples of usage for each function are provided in the format 's1.function()' or 's1.function(arguments)'.

Uploaded by

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

FUNCTIONS IN STRINGS :

Name Function Format

len - tells length of a string


len(s1)
capitalize - returns copy with 1st chr capital
[Link]()
count - returns no. of occurences of substring
[Link]('substring')
find - returns lowest index of a substring
[Link]('substring')
index - returns lowest index of a substring
[Link]('substring')
isalnum - True if string is alphabet or no.
[Link]()
isalpha - True if string is alphabet
[Link]()
isdigit - True if string is digit
[Link]()
islower - True if all chr in string are lower case
[Link]()
isupper - True if all chr in string are upper case
[Link]()
isspace - True if string has space
[Link]()
lower - returns copy converted to lower case
[Link]()
upper - returns copy converted to upper case
[Link]()
lstrip - returns copy with leading spaces removed
[Link]()
rstrip - returns copy with trailing spaces removed
[Link]()
strip - returns copy with both spaces removed
[Link]()
startswith - True if string starts with substring
[Link](substring)
endswith - True if string ends with substring
[Link](substring)
title - returns copy with titled case
[Link]()
istitle - True if string is in titled case
[Link]()
replace - returns copy with old substring replaced by new
[Link](oldsubstring,newsubstring)
join - joins a string(s2) after each chr of other string(s1)
[Link](s1)
split - returns list with containing split strings
[Link]()
partition - returns tuple with split strings at seperator
[Link](seperator)

You might also like