How to use shelve function to save data

Store dictionary to a file

The shelve module can do most of the work for a simple storage.

The shelve open function accepts a file name as its parameter. And it returns a Shelf object. We can then use Shelf object to store things. Just treat it as a normal dictionary whose keys must be strings, and when you're done you call its close method.





















Home »
  Python »
    Language Basics »




Python Basics
Operator
Statements
Function Definition
Class
Buildin Functions
Buildin Modules