Reading a shelve file. : Shelve : Database PYTHON TUTORIALS


PYTHON TUTORIALS » Database » Shelve »

 

Reading a shelve file.


import sys
import shelve

def outputLineaccount, aList ):
   print account.ljust10 ),
   print aList].ljust10 ),
   print aList].ljust10 ),
   print aList].rjust10 )

try:
   creditFile = shelve.open"credit.dat" )
except IOError:
   print >> sys.stderr, "File could not be opened"
   sys.exit)

for accountNumber in creditFile.keys():
   outputLineaccountNumber, creditFileaccountNumber ] )

creditFile.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Database
» Shelve