×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Pavel Evtikhov
Added: Feb 10, 2022 5:03 PM
Views: 406
Tags: no tags
  1. from os.path import isfile
  2. import json
  3.  
  4. if isfile(POST_PATH):
  5.     with open(POST_PATH, 'r', encoding='UTF-8') as file:
  6.         posts = json.load(file)
  7.  
  8. # аварийный выход, если файл не найден
  9. else:
  10.     print('Ошибка загрузки файла постов!')
  11.     exit()