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

Basic Flask web app

 from flask import Flask app = Flask(__name__) #In Flask, URL rules can be added using either the @app.route() decorator or the app.add_url_...