29 lines
791 B
Python
29 lines
791 B
Python
|
from flask import Flask
|
|||
|
|
|||
|
app = Flask(__name__)
|
|||
|
|
|||
|
|
|||
|
@app.route('/')
|
|||
|
def process_data():
|
|||
|
# ищет наименьшее число из файла /var/data/data.txt
|
|||
|
data_file = '/var/data/data.txt'
|
|||
|
# и сохраняет его третью степень в /var/result/result.txt
|
|||
|
result_file = '/var/result/result.txt'
|
|||
|
|
|||
|
with open(data_file, 'r') as file:
|
|||
|
numbers = [int(line.strip()) for line in file]
|
|||
|
|
|||
|
smallest_number = min(numbers)
|
|||
|
# выводит наименьшее число
|
|||
|
print(smallest_number)
|
|||
|
result = smallest_number ** 3
|
|||
|
|
|||
|
with open(result_file, 'w') as file:
|
|||
|
file.write(str(result))
|
|||
|
|
|||
|
return 'Результат успешно сохранен!\n'
|
|||
|
|
|||
|
|
|||
|
if __name__ == '__main__':
|
|||
|
app.run(host='0.0.0.0', port=5000)
|