I am doing practice project from Chapter 8 of "Automate the boring stuff with Python". I need to write commands that will delete a keyword from shelf and delete the whole database of keywords. I don't know what to try more. None of my attempts to delete anything seem to work. Would appreciate any help. Thank you
#!/usr/bin/env python3
# mcb.pyw - Multiclipboard
# A program that can save and load pieces of text to the clipboard.
# Usage: python3 mcb.pyw save <keyword> - Saves clipboard to keyword.
# python3 mcb.pyw <keyword> - Load keyword to clipboard.
# python3 mcb.pyw list - Load all keywords to clipboard.
import shelve, xerox, sys
mcbShelf = shelve.open('mcb')
if len(sys.argv) == 3 and sys.argv[1].lower()== 'save':
mcbShelf[sys.argv[2]] = xerox.paste()
elif len(sys.argv) == 2 and sys.argv[1].lower== 'clear':
for i in list(mcbShelf.keys()):
del mcbShelf[i]
elif len(sys.argv) == 2:
if sys.argv[1].lower() == 'list':
xerox.copy(str(list(mcbShelf.keys())))
elif sys.argv[1] in mcbShelf:
xerox.copy(mcbShelf[sys.argv[1]])
#Extend the multiclipboard program in this so that it has a delet #<keyword> command line argument that will delete a keyword from the shelf.
elif len(sys.argv) == 3 and sys.argv[1].lower()== 'delete' and sys.argv[2].lower() in mcbShelf.keys():
mcbShelf.pop[sys.argv[2]]
mcbShelf.close()