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()
|
|
|
Related Scripts with Example Source Code in same category :
-
|
|