[BangPypers] help needed with dictionary

sunny_plone san82moon at gmail.com
Fri Aug 29 11:57:18 CEST 2008


hi,
sorry for late reply.
i want to create a address book which has fields like name, phno, email id
etc which are keys.... and i want each key to hav multiple values.... as
many users will enter their names. so name key will contain many values. i
am not able to store the values entered through command line. i am able to
store 1st value, but wen sec value is entered first one is erased.
i hope i cleard ur doubts....

Noufal wrote:
> 
> On Fri, Aug 29, 2008 at 2:32 PM, sunny_plone <san82moon at gmail.com> wrote:
>>
>>  hi all,
>> i am a newbie in python.  i was trying to work with dictionaries.  i
>> wanted
>> to input values  through command line and store the values in a
>> dictionary.
>> i mean for the same key , multiple values. can any1 suggest me how can i
>> do
>> it.....thank you....
> 
> I'm not sure what your code is trying to do but this kind of thing is
> usually done like this.
> 
> kev = dict()
> kev.setdefault("Name",[])
> kev["Name"].append(person_name)
> 
> 
> -- 
> ~noufal
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
> 
> 

-- 
View this message in context: http://www.nabble.com/help-needed-with-dictionary-tp19215907p19217025.html
Sent from the BangPypers - Bangalore Python Users Group mailing list archive at Nabble.com.



More information about the BangPypers mailing list