Thursday, October 8, 2020

Python String methods

Python methods for strings
  1.   title()
  2. capitalize()
  3. swapcase()
  4. find()
  5. count()
  6. replace()
  7. isalnum()
  8. format()

print(dir(variable_name)) gives all the functions that can be applied on the variable. If its a string variable, it will list all the functions applicable on strings. 

You can also use print(help(str)) go get all information about strings.

print(help.(str.find)) will give the details on how to use the find() function.

Python methods for objects:
  1. reverse()
  2. clear()
  3. add
  4. append()
  5. update()

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...