-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreader.py
More file actions
24 lines (20 loc) · 678 Bytes
/
reader.py
File metadata and controls
24 lines (20 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template('reader_main.html')
@app.route('/display', methods=['POST','GET'])
def read():
file_name = request.form['file_box']
infile = open(file_name, 'r')
numbers = infile.readlines()
infile.close()
string = ''
#payload = {}
#for index in range(len(numbers)):
# payload['key'+str(index)] = numbers[index].rstrip()
for number in numbers:
string += number.rstrip() + ', '
return render_template('reader_output.html', paragraph=string)
if __name__ == '__main__':
app.run(debug=True)