Adding Entries to a DBM File : DBM : Database PYTHON TUTORIALS


PYTHON TUTORIALS » Database » DBM »

 

Adding Entries to a DBM File


import anydbm

cities = ["Dallas""Los Angeles""New York"]
flights = ["1144""1045""1520"]
times = ["230pm""320pm""420pm"]

cityDB = anydbm.open("city.dbm"'n')
timeDB = anydbm.open("time.dbm"'n')

i = 0
for flight in flights:
    cityDB[flight= cities[i]
    i += 1
i = 0
for flight in flights:
    timeDB[flight= times[i]
    i += 1

print cityDB.items()
print timeDB.items()

cityDB.close()
timeDB.close()



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Database
» DBM