I\'m writing a program, it works fine but when it loads the database(a 100MB text file) to a list it\'s memory usage becomes 700-800MB
Code used to load the file to
As long as you don't need the complete file in memory, you could read one line at a time:
database = [] db = open('database/db.hdb') line = db.readline() while line: line = line.split(':') database.append(line) line = db.readline()
See here for details on file.readline()