Python String functions

Len Function

Len function used to count character in string.

mystring = “Hello World” 
print(len(mystring))

Output: 11

Lower function

Lower function used to convert string in lower case.

mystring = “Hello World” 
print(mystring lower())

Output: hello word

 

Upper function

Upper  function used to convert string in upper case.

mystring = “Hello World” 
print(mystring.upper())

Output: HELLO WORLD

Find function

Find function used to search index number of particular characters in string.

mystring = “test word”
mystring.find(“e”)

Output =1

Split Function

Split function used to split string using particular chracter

mystring =”hello world”
mystring.split(“e”)

Output: [‘h’, ‘ello world’]

Leave a Comment

Your email address will not be published. Required fields are marked *