DmitrMakeev commited on
Commit
0211e91
·
1 Parent(s): a9fa911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,7 +12,8 @@ def upload_file():
12
  txt_file = request.files['txt_file']
13
 
14
  # Считываем строки из загруженного файла TXT
15
- lines = txt_file.read().decode().split("")
 
16
 
17
  # Создаем словарь в формате JSON
18
  json_data = {str(index+1): line.strip() for index, line in enumerate(lines)}
@@ -21,7 +22,7 @@ def upload_file():
21
  with open('output.json', 'w') as json_file:
22
  json_file.write(jsonify(json_data).get_data(as_text=True))
23
 
24
- return 'Файл успешно обработан и создан файл JSON'
25
 
26
  return render_template('index.html')
27
 
 
12
  txt_file = request.files['txt_file']
13
 
14
  # Считываем строки из загруженного файла TXT
15
+ lines = txt_file.read().decode().split("
16
+ ")
17
 
18
  # Создаем словарь в формате JSON
19
  json_data = {str(index+1): line.strip() for index, line in enumerate(lines)}
 
22
  with open('output.json', 'w') as json_file:
23
  json_file.write(jsonify(json_data).get_data(as_text=True))
24
 
25
+ return render_template('index.html', json_data=json_data)
26
 
27
  return render_template('index.html')
28