Re: how to find position of dictionary values

2008-09-01 Thread Terry Reedy
Alexandru Palade wrote: > lookfor = 'dfsdf' > for item, value in kev.items(): >if lookfor in value: >print item >print value.index(lookfor) >break # assuming you only want one result slight variation: lookfor = 'dfsdf' for item, value i

Re: how to find position of dictionary values

2008-09-01 Thread Bruno Desthuilliers
lee a écrit : On Sep 1, 2:37 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: lee wrote: (snip) i agree with u, my data strusture is not efficient. but all the records,viz...name,phno, email,address are all generated at runtime , when the user enters them. so how can i design my datastructur

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 3:59 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Mon, 1 Sep 2008 03:51:13 -0700 (PDT), lee wrote: > > i am soory for that keystrokes. can anyone tell me how can i change > > the value of key. > > suppose i have a dictionary > > > kev = {'kabir': ['[EMAIL PROTECTED]', '1234', 'miss

Re: how to find position of dictionary values

2008-09-01 Thread Wojtek Walczak
On Mon, 1 Sep 2008 03:51:13 -0700 (PDT), lee wrote: > i am soory for that keystrokes. can anyone tell me how can i change > the value of key. > suppose i have a dictionary > > kev = {'kabir': ['[EMAIL PROTECTED]', '1234', 'missuri'], 'shri': > ['[EMAIL PROTECTED]', '23423', 'india'], 'marsa': ['[

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 2:37 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > lee wrote: > > On Sep 1, 1:45 pm, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote: > >> lee a écrit : > > >> > hi, > >> > i have a dictionary as follows : > >> > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', > >> >

Re: how to find position of dictionary values

2008-09-01 Thread Diez B. Roggisch
lee wrote: > On Sep 1, 1:45 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> lee a écrit : >> >> > hi, >> > i have a dictionary as follows : >> > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', >> > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], >> > 'addres

Re: how to find position of dictionary values

2008-09-01 Thread Bruno Desthuilliers
lee a écrit : hi, thank u your solution is exactly wat i wanted :) I'm afraid it's not what you actually *need*, cf my other post. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 1:45 pm, Bruno Desthuilliers wrote: > lee a écrit : > > > hi, > > i have a dictionary as follows : > > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', > > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], > > 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} > >

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 1:45 pm, Bruno Desthuilliers wrote: > lee a écrit : > > > hi, > > i have a dictionary as follows : > > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', > > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], > > 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} > >

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 1:45 pm, Bruno Desthuilliers wrote: > lee a écrit : > > > hi, > > i have a dictionary as follows : > > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', > > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], > > 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} > >

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 1:45 pm, Bruno Desthuilliers wrote: > lee a écrit : > > > hi, > > i have a dictionary as follows : > > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', > > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], > > 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} > >

Re: how to find position of dictionary values

2008-09-01 Thread Bruno Desthuilliers
lee a écrit : hi, i have a dictionary as follows : kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} if user is enters the 3rd item of key phno, ie "dfsdf" in my dict, how

Re: how to find position of dictionary values

2008-09-01 Thread lee
On Sep 1, 1:21 pm, Alexandru Palade <[EMAIL PROTECTED]> wrote: > lookfor = 'dfsdf' > for item, value in kev.items(): > if lookfor in value: > print item > print value.index(lookfor) > break # assuming you only want one result > > You can als

Re: how to find position of dictionary values

2008-09-01 Thread Alexandru Palade
lookfor = 'dfsdf' for item, value in kev.items(): if lookfor in value: print item print value.index(lookfor) break # assuming you only want one result You can also skip the 'if' verification in which case you need to catch ValueError exceptio