DAS_2023_1/basharin_sevastyan_lab_2/app1/main.py
2023-11-21 21:21:04 +04:00

15 lines
444 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
def main():
data_dir = 'var/data'
result_file = '/var/result/data.txt'
min_name = min(os.listdir(data_dir)) # Ищем и записываем самое короткое название (включая расширение)
with open(result_file, 'w') as result:
result.write(min_name)
print(f'В файл {result_file} было записано {min_name}')
if __name__ == "__main__":
main()