http://paste.pocoo.org/show/231731/

My problem is listed here... There shouldn't really be a reason (as far as I can see) with memory... If there's another way to get a dictionary from a .txt file that'd work/is more efficient, I'm looking for help. P:

The general way to create a dictionary is to split the text file records into a key and data, then

if key not in the_dictionary:
    the_dictionary[key] = []     ## this is a list but you can use whatever type you want
the_dictionary[key].append(data)

For additional help you should post some of the input file and how you want to store each record.

http://paste.pocoo.org/show/231731/

My problem is listed here... There shouldn't really be a reason (as far as I can see) with memory... If there's another way to get a dictionary from a .txt file that'd work/is more efficient, I'm looking for help. P:

This line is stupid:

dictionary_being_manipulated = eval(dictionary_opened.read())

You are trying to evaluate all file as Python expression.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.