How to get query String in Flask?

Answer

We can get the argument’s value using the request object in Flask.

An example is shown below.

from flask import Flask
from flask import request
 
app = Flask(__name__)
 
@app.route("/")
def index():
val = request.args.get("var")
 
return "Hello, World! {}".format(val)
 
if __name__=="__main__":
app.run(host="0.0.0.0", port=8080)

 

All flask Questions

Ask your interview questions on flask

Write Your comment or Questions if you want the answers on flask from flask Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---