String function in python

technical talkiess
0

  in the following example we learn the python string function In python


var = "in the following example we learn the python string function"

print(len(var))

len function return the length of the string In python

the following code return full string In python
print(var[::])

the following code skip the one character In python
print(var[::2])

the following code uppercase the string In python
print(var.upper())

the following code lowercase the string In python
print(var.lower())

the following code replace  the string to any other element In python
print(var.replace("in","to"))

the following code check the given string end the given text or not ---- its return true or false In python
print(var.endswith("function"))


the following code convert the fllowing string in to the capitalizsed In python
print(var.capitalize())


the following code find any code in the given string..... its return the index of the word In python
print(var.find("in"))

the following code converts string into lower case In python
print(var.casefold())

Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)