How you can access sessions in flask?



How you can access sessions in flask?..

Answer / Sajjan Singh

To access sessions in Flask, first import the `session` object from the `flask` module: `from flask import session`. Then, to set a session variable, use `session['key'] = value`, and to retrieve a session variable, use `session.get('key')`. Always remember to initialize the session with `app.secret_key`.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is *args and **kwargs?

1 Answers  


What is the difference between remove() function and del statement?

1 Answers  


Explain me what is python and explain some of its benefits?

1 Answers  


What are uses of lambda?

1 Answers  


How do you convert a number into a string?

1 Answers  


Name few python web application frameworks?

1 Answers  


What is the difference between methods & constructors?

1 Answers  


How will you convert an integer to a unicode character?

1 Answers  


which standard datatype in python is immutable?

1 Answers  


What is difference between raw_input and input in python?

1 Answers  


What is a lambda in coding?

1 Answers  


Is tensorflow written in python?

1 Answers  


Categories