|
|
|
|
@ -14,8 +14,8 @@ class BookManager:
|
|
|
|
|
"""从文件加载图书数据"""
|
|
|
|
|
if os.path.exists(self.data_file):
|
|
|
|
|
try:
|
|
|
|
|
with open(self.data_file, 'r', encoding='utf-8') as f:
|
|
|
|
|
return json.load(f)
|
|
|
|
|
#with open(self.data_file, 'r', encoding='utf-8') as f:
|
|
|
|
|
# return json.load(f)
|
|
|
|
|
except (json.JSONDecodeError, IOError) as e:
|
|
|
|
|
print(f"加载图书数据失败: {e}")
|
|
|
|
|
return []
|
|
|
|
|
|