.emacs.d/snippets/python-mode/file-read

9 lines
176 B
Plaintext
Raw Normal View History

# -*- mode: python -*-
# name: file-read
# key: fr
# --
with open($0, 'r') as file:
try:
data = json.load(file)
except (json.JSONDecodeError):
data = {}