I am supposed to use the command line argument to save content to keywords or (and here is my issue; delete keywords)
Hey I already researched similar questions. However, I do not see why it does not work out in my program. Every time I use python mcb.py delete a. It still comes up. I cannot delete it. Hope you can help me out on this one
#! /usr/bin/env python3
import sys, pyperclip, shelve
mcbShelf = shelve.open('mcb')
if len(sys.argv) == 3 and sys.argv[1].lower() == 'save':
mcbShelf[sys.argv[2]] = pyperclip.paste()
elif len(sys.argv) == 2:
if sys.argv[1].lower() == 'list':
pyperclip.copy(str(list(mcbShelf.keys())))
elif sys.argv[1] in mcbShelf:
pyperclip.copy(mcbShelf[sys.argv[1]])
elif len(sys.argv)==3 and sys.argv[1].lower() == 'delete':
#del mcbShelf[sys.argv[2]]
mcbShelf.pop(sys.argv[2])
#mcbShelf.clear()
#mcbShelf.pop(sys.argv[2])
mcbShelf.close()