Re: Help about dictionary append

2012-02-06 Thread bruno.desthuilli...@gmail.com
On Feb 5, 4:29 pm, Andrew Berg wrote: > This has nothing to do with dictionaries. If you want to add, delete, or > change items, use a list (or a set if there aren't supposed to be any > duplicates). AND you don't care about ordering... -- http://mail.python.org/mailman/listinfo/python-list

Re: Help about dictionary append

2012-02-05 Thread Anatoli Hristov
Thanks Chris, It works fine, I see it will take time till I understand all the syntax :( A.H On Sun, Feb 5, 2012 at 4:20 PM, Chris Angelico wrote: > On Mon, Feb 6, 2012 at 2:13 AM, Anatoli Hristov wrote: > > Hi there, > > > > I`m again confused and its the dictionary. As dictionary does not s

Re: Help about dictionary append

2012-02-05 Thread Andrew Berg
On 2/5/2012 9:13 AM, Anatoli Hristov wrote: > and I get and error that TUPLE object has no attribute Append !!! You defined mydict['name'] as a tuple, and tuples are immutable. Using a tuple means that you don't ever want the values to change. > But how to add new Values to a dictionary then ? Thi

Re: Help about dictionary append

2012-02-05 Thread James Broadhead
On 5 February 2012 15:13, Anatoli Hristov wrote: > Hi there, > > I`m again confused and its the dictionary. As dictionary does not support > append I create a variable list with dictionary key values and want to add > new values to it and then copy it again to the dictionary as I dont know > other

Re: Help about dictionary append

2012-02-05 Thread Chris Angelico
On Mon, Feb 6, 2012 at 2:13 AM, Anatoli Hristov wrote: > Hi there, > > I`m again confused and its the dictionary. As dictionary does not support > append I create a variable list with dictionary key values and want to add > new values to it and then copy it again to the dictionary as I dont know >

Help about dictionary append

2012-02-05 Thread Anatoli Hristov
Hi there, I`m again confused and its the dictionary. As dictionary does not support append I create a variable list with dictionary key values and want to add new values to it and then copy it again to the dictionary as I dont know other methods. mydict = {'Name':('Name1','Name2','Name3'),'Tel':(

Re: simple question about Dictionary type containing List objects

2009-07-13 Thread Ulrich Eckhardt
gganesh wrote: > I have a dict object like > emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com', > 'z...@gmail.com'], 'myname':['gganesh']} > I need to get the lenght of the list mycontacts ,like > mycontacts_numbers=3 mycontacts = emails['mycontacts'] mycontacts_number = len(mycontacts) A

Re: simple question about Dictionary type containing List objects

2009-07-13 Thread Xavier Ho
On Mon, Jul 13, 2009 at 6:34 PM, gganesh wrote: > Hi group, > I have a dict object like > emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com', > 'z...@gmail.com'], 'myname':['gganesh']} > I need to get the lenght of the list mycontacts ,like > mycontacts_numbers=3

simple question about Dictionary type containing List objects

2009-07-13 Thread gganesh
Hi group, I have a dict object like emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com', 'z...@gmail.com'], 'myname':['gganesh']} I need to get the lenght of the list mycontacts ,like mycontacts_numbers=3 help me to solve Thanks -- http://mail.python.org/mailman/listinfo/python-list

About dictionary in combobox in pygtk

2009-05-21 Thread shruti surve
hi all, My data has thousands of entries. I 'd like to feed the combobox with dictionary.how to use dictionary in combobox? Regards, shruti surve -- http://mail.python.org/mailman/listinfo/python-list

about dictionary

2005-11-20 Thread Technical Support of Intercable Co
>>> b=dict.fromkeys(a) -- http://mail.python.org/mailman/listinfo/python-list

Re: about dictionary

2005-11-20 Thread Bengt Richter
On Sun, 20 Nov 2005 07:12:08 -0800, Shi Mu <[EMAIL PROTECTED]> wrote: >d is a dictionary. d >{0: [[0, 1], [0, 2]], 1: [[0, 1], [1, 2], [1, 3]], 2: [[0, 2], [1, 2], >[2, 3]], 3: [[1, 3], [2, 3]]} > >for the value under each key, if the possible connection is in the >dictionary, for example, un

about dictionary

2005-11-20 Thread Shi Mu
d is a dictionary. >>> d {0: [[0, 1], [0, 2]], 1: [[0, 1], [1, 2], [1, 3]], 2: [[0, 2], [1, 2], [2, 3]], 3: [[1, 3], [2, 3]]} for the value under each key, if the possible connection is in the dictionary, for example, under key 0. 1 and 2 were found to have a pair in some other places so get [0,1,

Re: about dictionary

2005-11-20 Thread przemek drochomirecki
Uzytkownik "Shi Mu" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] On 11/20/05, przemek drochomirecki <[EMAIL PROTECTED]> wrote: > > Uzytkownik "Peter Otten" <[EMAIL PROTECTED]> napisal w wiadomosci > news:[EMAIL PROTECTED] > > Shi Mu wrote: > > > > > how to do with it? > > > > Us

Re: about dictionary

2005-11-20 Thread Shi Mu
On 11/20/05, przemek drochomirecki <[EMAIL PROTECTED]> wrote: > > Uzytkownik "Peter Otten" <[EMAIL PROTECTED]> napisal w wiadomosci > news:[EMAIL PROTECTED] > > Shi Mu wrote: > > > > > how to do with it? > > > > Use Ben Finney's, not Przemek's approach if the values are mutables that > you > > plan

Re: about dictionary

2005-11-20 Thread przemek drochomirecki
Uzytkownik "Peter Otten" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] > Shi Mu wrote: > > > how to do with it? > > Use Ben Finney's, not Przemek's approach if the values are mutables that you > plan to modify. If that's what you are asking. > > Peter Maybe he just want to use d

Re: about dictionary

2005-11-20 Thread Peter Otten
Shi Mu wrote: > how to do with it? Use Ben Finney's, not Przemek's approach if the values are mutables that you plan to modify. If that's what you are asking. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: about dictionary

2005-11-20 Thread Shi Mu
On 11/20/05, Peter Otten <[EMAIL PROTECTED]> wrote: > przemek drochomirecki wrote: > > > Uzytkownik "Shi Mu" <[EMAIL PROTECTED]> napisal w wiadomosci > > news:[EMAIL PROTECTED] > > I have have the following code: > a=[3,5,8,0] > b={} > > > How I can i assign each item in a as the key

Re: about dictionary

2005-11-20 Thread Peter Otten
przemek drochomirecki wrote: > Uzytkownik "Shi Mu" <[EMAIL PROTECTED]> napisal w wiadomosci > news:[EMAIL PROTECTED] > I have have the following code: a=[3,5,8,0] b={} > How I can i assign each item in a as the key in the dictionary b > simultaneously? > that is, > b={3:[],5:[],8:[]

Re: about dictionary

2005-11-20 Thread przemek drochomirecki
Uzytkownik "Shi Mu" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] I have have the following code: >>> a=[3,5,8,0] >>> b={} >>> How I can i assign each item in a as the key in the dictionary b simultaneously? that is, b={3:[],5:[],8:[],0:[]} Thanks! Other solution: b.fromkeys(a,

Re: about dictionary

2005-11-20 Thread Ben Finney
Shi Mu <[EMAIL PROTECTED]> wrote: > I have have the following code: > >>> a=[3,5,8,0] > >>> b={} > >>> > How I can i assign each item in a as the key in the dictionary b > simultaneously? > that is, > b={3:[],5:[],8:[],0:[]} Explicit: a = [3, 5, 8, 0] b = {} for key in a: b[ke

Re: about dictionary

2005-11-20 Thread Shi Mu
On 20 Nov 2005 02:59:30 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > b = dict([(x,dict()) for x in a]) > Shi Mu wrote: > > I have have the following code: > > >>> a=[3,5,8,0] > > >>> b={} > > >>> > > How I can i assign each item in a as the key in the dictionary b > > simultaneously? > > t

Re: about dictionary

2005-11-20 Thread [EMAIL PROTECTED]
b = dict([(x,dict()) for x in a]) Shi Mu wrote: > I have have the following code: > >>> a=[3,5,8,0] > >>> b={} > >>> > How I can i assign each item in a as the key in the dictionary b > simultaneously? > that is, > b={3:[],5:[],8:[],0:[]} > Thanks! -- http://mail.python.org/mailman/listinfo/pytho

about dictionary

2005-11-20 Thread Shi Mu
I have have the following code: >>> a=[3,5,8,0] >>> b={} >>> How I can i assign each item in a as the key in the dictionary b simultaneously? that is, b={3:[],5:[],8:[],0:[]} Thanks! -- http://mail.python.org/mailman/listinfo/python-list