title: How to empty DBM file in Python efficiently?
body: <p>There is a command in DBM module to delete the value stored at a key.</p>
  
  <pre><code>del d[key]      # delete data stored at key (raises KeyError   # if no such key)
  </code></pre>
  
  <p>But I cannot even iterate with this command, because the Runtime error occurs.(RuntimeError: dictionary changed size during iteration.)</p>
  
  <pre><code>import dbm
  db=dbm.open("file.db","c")
  for key in db:
      del db[key]
  print(len(db))
  db.close()
  </code></pre>
  
  <p>Is there an efficient way to empty DMB file at once?
  I am using Python 3.3</p>