Re: In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-22 Thread Peter Otten
Aaron Christensen wrote: > Thanks for the response! Several things you stated definitely got me > thinking. I really appreciate the response. I used what you said and I > am able to accomplish what I needed. Perhaps it becomes clearer when you write two helper functions def read_record(key):

In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron
Hello, I am trying to figure out how to populate a shelve file with a nested dictionary. These are my requirements: -Create shelve file called people.db -Append the shelve file with new people (person_1, person_2, etc.). -Use a for loop to iterate through 'attributes' so that I do not need to

In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron Christensen
Hello, I am trying to figure out how to populate a shelve file with a nested dictionary. These are my requirements: -Create shelve file called people.db -Append the shelve file with new people (person_1, person_2, etc.). -Use a for loop to iterate through 'attributes' so that I do not need to

Re: In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Peter Otten
Aaron Christensen wrote: > Hello, > > I am trying to figure out how to populate a shelve file with a nested > dictionary. > > These are my requirements: > > -Create shelve file called people.db > -Append the shelve file with new people (person_1, person_2, etc.). > -Use a for loop to iterate

Re: In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron Christensen
Hi Peter, Thanks for the response! Several things you stated definitely got me thinking. I really appreciate the response. I used what you said and I am able to accomplish what I needed. Thanks! Aaron On Mon, Dec 21, 2015 at 7:23 PM, Peter Otten <__pete...@web.de> wrote: > Aaron

How to append to a dictionary

2006-05-19 Thread Harlin Seritt
I have some code here: groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} I want to add another key: 'ITALIAN' : 'orange' How do I append this to 'groups'? Thanks, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: How to append to a dictionary

2006-05-19 Thread Tim Chase
groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} I want to add another key: 'ITALIAN' : 'orange' How do I append this to 'groups'? groups['ITALIAN'] = 'orange' as described at http://docs.python.org/tut/node7.html#SECTION00750 -tkc --

Re: How to append to a dictionary

2006-05-19 Thread Sybren Stuvel
Harlin Seritt enlightened us with: I have some code here: groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} I want to add another key: 'ITALIAN' : 'orange' How do I append this to 'groups'? groups['ITALIAN'] = 'orange' Sybren -- The problem with the world is stupidity. Not saying there

Re: How to append to a dictionary

2006-05-19 Thread Ben Finney
Harlin Seritt [EMAIL PROTECTED] writes: groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} I want to add another key: 'ITALIAN' : 'orange' How do I append this to 'groups'? Dictionary items have no implicit sequence, so you don't append to one. Assigning any value to a key in the