title: Deleting all keys in a shelve file through terminal/command line
body: <p>I'm trying to delete all items in a shelve file by allowing the user to type "clear" in terminal. </p>
  
  <p>Based on several threads I've read on this website, shelve files generally behave like dictionaries, so the <code>.clear</code> method and several other approaches should work, and in fact do when I test them out in the interactive shell. But I can't get them to work in my program.</p>
  
  <p>Here's my latest attempt (which worked in the shell):</p>
  
  <pre><code>elif len(sys.argv) == 3 and sys.argv[1].lower() == 'clear':
      for key in mcbShelf:
          del mcbShelf[key]
  </code></pre>
  
  <p>Just using <code>del</code> on mcbShelf also did not work.</p>
  
  <p>My program also has a "list" feature that lists all of the keys stored in the shell.</p>
  
  <pre><code>elif len(sys.argv) == 2:
      #list keywords
      if sys.argv[1].lower() == 'list':
          pyperclip.copy(str(list(mcbShelf.keys())))
  </code></pre>
  
  <p>When I try <code>python3.5 mcb4.pyw clear</code> in Terminal, then run <code>python3.5 mcb4.pyw list</code>, I believe an empty list should be copied to the clipboard. But the list has objects in it.</p>
  
  <p>Any thoughts? </p>