#!/usr/bin/env python3
#encoding=utf-8


#-----------------------------------------
# Usage: python3 updatedb.py
# Description: example for shelve
#-----------------------------------------



import shelve

# Read shelve
db = shelve.open('persondb')                    # Reopen shelve with same filename

for key in sorted(db):                          # Iterate to display database objects
    print(key, '\t=>', db[key])                 # Prints with custom format



# Update shelve
sue = db['Sue Jones']                           # Index by key to fetch
sue.giveRaise(.10)                              # Update in memory using class's method

db['Sue Jones'] = sue                           # Assign to key to update in shelve
db.close()                                      # Close after making changes



8860ab37f12c6ad8b2adfc9e8130746ba8296654
<mask token>

<mask token>
for key in sorted(db):
    print(key, '\t=>', db[key])
<mask token>
sue.giveRaise(0.1)
<mask token>
db.close()

<mask token>
db = shelve.open('persondb')
for key in sorted(db):
    print(key, '\t=>', db[key])
sue = db['Sue Jones']
sue.giveRaise(0.1)
db['Sue Jones'] = sue
db.close()

import shelve
db = shelve.open('persondb')
for key in sorted(db):
    print(key, '\t=>', db[key])
sue = db['Sue Jones']
sue.giveRaise(0.1)
db['Sue Jones'] = sue
db.close()

#!/usr/bin/env python3
#encoding=utf-8


#-----------------------------------------
# Usage: python3 updatedb.py
# Description: example for shelve
#-----------------------------------------



import shelve

# Read shelve
db = shelve.open('persondb')                    # Reopen shelve with same filename

for key in sorted(db):                          # Iterate to display database objects
    print(key, '\t=>', db[key])                 # Prints with custom format



# Update shelve
sue = db['Sue Jones']                           # Index by key to fetch
sue.giveRaise(.10)                              # Update in memory using class's method

db['Sue Jones'] = sue                           # Assign to key to update in shelve
db.close()                                      # Close after making changes


