From 9acf6160b2d0f669bdf716e85166f37ad4053272 Mon Sep 17 00:00:00 2001 From: MarioGonzalez844 Date: Sun, 11 Dec 2016 20:59:51 -0500 Subject: [PATCH] Update library.py --- library.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library.py b/library.py index 02e5fcf..653282d 100644 --- a/library.py +++ b/library.py @@ -51,12 +51,16 @@ def add_book(filename, isbn, title, author): def remove_book(filename, isbn): students, books = open_library(filename) - + # How can we *remove* an item from a dictionary? # Write code to delete the book keyed by isbn in the space below - + if 'isbn' in books: + del books['isbn'] + # Now write code that saves the new version of the data to your library - + with open(filename) as f: + json.dump({;students':students,'books':books}, f) + def check_out(filename, isbn, s_id): students, books = open_library(filename)