forked from roytuts/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (37 loc) · 1.22 KB
/
main.py
File metadata and controls
55 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from flask import Flask, session, render_template
app = Flask(__name__)
app.secret_key = "secret key"
@app.route('/')
def app_session():
#session['msg'] = 'Hello'
session.modified = True
#session['msg'] = 'Hello, Soumitra'
#print(session.get('msg'))
#session.pop('msg')
#print(session.get('msg'))
#session['hi'] = 'Hi'
#session['hello'] = 'Hello'
#for key, val in session.items():
#print(key + ' -> ' + val)
#print(key, ' -> ', val)
#session.clear()
#itemArray = {'name' : 'Soumitra', 'email' : 'soumitra@roytuts.com', 'address' : 'Earth'}
#session['item'] = itemArray
#if 'item' in session:
# session['item'].pop('name')
#session.pop('item')
#if 'item' in session:
# for key, val in session['item'].items():
# print(key + ' -> ' + val)
itemNestedArray = { 'key' : {'name' : 'Soumitra', 'email' : 'soumitra@roytuts.com', 'address' : 'Earth'}}
session['item'] = itemNestedArray
if 'item' in session:
for item in session['item'].items():
print(item)
session['item'].pop('key')
if 'item' in session:
for item in session['item'].items():
print(item)
return render_template('template.html')
if __name__ == "__main__":
app.run()