Re: trying to understand dictionaries

2009-06-12 Thread Albert Hopkins
On Fri, 2009-06-12 at 04:51 -0700, khem...@gmail.com wrote: > Hi. > As the subject says, I'm a newbie trying to learn python and now > dictionaries. I can create a dict, understand it and use it for simple > tasks. But the thing is that I don't really get the point on how to > use these in real lif

Re: trying to understand dictionaries

2009-06-12 Thread Alan G Isaac
On 6/12/2009 7:51 AM khem...@gmail.com apparently wrote: > d = {'fname': [], 'ename': []} > name1 = 'ricky' > name2 = 'martin' > d['fname'].append(name1) > d['ename'].append(name2) > > name1 = 'britney' > name2 = 'spears' > d['fname'].append(name1) > d['ename'].append(name2) > > > This gives me:

Re: trying to understand dictionaries

2009-06-12 Thread Jean-Michel Pichavant
Basically, dictionaries are a bunch of couples of key and value where key is an immutable object. In fact you'll find a more accurate definition in any python book or online tutorial. The thing is that keys are usually used as an easy and quick way the search and index items. You can see dict a

trying to understand dictionaries

2009-06-12 Thread khem...@gmail.com
Hi. As the subject says, I'm a newbie trying to learn python and now dictionaries. I can create a dict, understand it and use it for simple tasks. But the thing is that I don't really get the point on how to use these in real life programing. For example I tryed to create a very simple phonebook