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

Is the number of all INTO functions from the set {1, 2, 3, ..... n} to itself equal to all number of MANY to ONE fuctions?

Yes,  t he number of all into functions from the set {1, 2, 3, .... n} to itself is exactly equal to the number of many-to-one functions ...