Python Pre-define function

String Predefine function

Predefine function/Method Description
strip( ) function

The strip( ) method removes any whitespace from the beginning or the end.

len( ) function The len( ) method returns the length of a string,tuple,list,sets,Dictionary.
lower( ) function The lower( ) method returns the string in lower case.
upper( ) function The upper( ) method returns the string in the upper case.
replace( ) function The replace( ) method replaces a string with another string.
split( ) function The split( ) method splits.
strip( ) function

 This method removes any whitespace from the beginning or the end.

a = "     Hello,NIELITBHU World! "
print(a.strip())

Output

Hello,NIELITBHU World!
len( ) function

The len( ) method returns the length of a string,tuple,list,sets,Dictionary.

a = "Hi,NIELITBHU"
print(len(a))

Output

12
lower( ) function

The lower( ) method returns the string in lower case.

a = "Hi,NIELITBHU"
print(a.lower())

Output

hi,nielitbhu
upper( ) function

The upper( ) method returns the string in the upper case.

a = "hi,nielitbhu"
print(a.upper())

Output

HI,NIELITBHU
replace( ) function

The replace( ) method replaces a string with another string.

a = "hi,nielitbhu"
print(a.replace("h", "#"))

Output

#i,nielitb#u
split( ) function

The split( ) method splits.

a = "hi,nielit,bhu"
print(a.split(","))

Output

[‘hi’, ‘nielit’, ‘bhu’]
English Hindi