Код:
import telebot
import random
import json
import time
BOT_TOKEN = 'Фиг тебе'
bot = telebot.TeleBot(BOT_TOKEN)
DATABASE_USER = 'user_data.json'
COOLDOWN = 3600
try:
with open(DATABASE_USER, 'r') as f:
user_data = json.load(f)
except FileNotFoundError:
user_data = {}
def save_data():
with open(DATABASE_USER, 'w') as f:
json.dump(user_data, f, indent=4)
И так дальше
Запускаю код выдает ошибку: json.decoder.JSONDecodeError: Expecting value: line 18 column 19 (char 348).
Часть кода где выдает ошибку:
try:
with open(DATABASE_USER, 'r') as f:
user_data = json.load(f)
except FileNotFoundError:
user_data = {}
def save_data():
with open(DATABASE_USER, 'w') as f:
json.dump(user_data, f, indent=4)
Что делать?