[BangPypers] help needed with dictionary

Ataulla S H ataulla at gmail.com
Fri Aug 29 12:17:21 CEST 2008


hi,

use list as a value for a key
ex:
mydict = {'phno':[32232323,3435,6756452342323,43343434],
'name':['ksdhsdhji','sdhghjsdh']}


On Fri, Aug 29, 2008 at 3:42 PM, sunny_plone <san82moon at gmail.com> wrote:

>
> hi ,
> actually my main problem is the the key name or Name should store multiple
> values, but now the old value gets replced wen new value is entered. how
> can
> i store old n new values for same key.
>
> Anand-17 wrote:
> >
> > On Fri, Aug 29, 2008 at 3:27 PM, sunny_plone <san82moon at gmail.com>
> wrote:
> >>
> >> 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.
> >
> > Shouldn't the code be this?
> > key[name].append(person_name)
> >
> > Looks like you are always using the same key "Name".
> > _______________________________________________
> > 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-tp19215907p19217224.html
> Sent from the BangPypers - Bangalore Python Users Group mailing list
> archive at Nabble.com.
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
Ataulla SH

web:www.kring.com
personal blog:www.ataulla.objectis.net
KRING Technologies India Pvt. Ltd.
1st Floor, Tower B, Infinity Towers, DLF II, Gurgaon-122 002
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20080829/5199b683/attachment.htm>


More information about the BangPypers mailing list