Learning about dictionaries for a database possibly in the future.

On Wednesday, May 31, 2017 at 8:58:39 PM UTC-4, MRAB wrote:
> On 2017-06-01 01:29, David D wrote:
> > I have a dictionary with a 10 people, the key being a number (0-10) and the 
> > value being the people's name.  I am in the processing of Insert, Adding 
> > and deleting from the dictionary.  All seems well until I delete a person 
> > and add a new one.  The numbers (keys) do not change and so I am getting an 
> > non-sequential set of numbers for the keys.  Is there a way of performing 
> > this where the key will update so that is continues to work sequentially?  
> > Here is what I mean
> > 
> > Print dictionary
> > {0 John, 1 David, 2 Phil, 3 Bob}
> > 
> > remove 1 David
> > {0 John, 2 Phil, 3 Bob}
> > 
> > How can I get it so that the VALUE will reset and it will look like this 
> > after both adding or deleting?
> > 
> > {0 John, 1 Phil, 2 Bob}
> > 
> Why are you using a dictionary instead of a list?

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to