There is absolutely no doubt that this should be done using a database, and not for pickle databases designed specifically for this kind of problem.
, , sqllite . , , SQL, , , . , , SQLAlchemy, " Mapper ", , .
import os
import sqlite3
my_huge_dictionary = {"A": 1, "B": 2, "C": 3, "D": 4}
conn = sqlite3.connect('my.db')
c = conn.cursor()
c.execute("""
create table dictionary (
k char[10] NOT NULL,
v integer NOT NULL,
PRIMARY KEY (k))
""")
for k, v in my_huge_dictionary.items():
c.execute("insert into dictionary VALUES ('%s', %d)" % (k, v))
my_key = "A"
c.execute("select v from dictionary where k == '%s'" % my_key)
my_value = c.next()[0]
print my_value
!