Re: Init a dictionary with a empty lists

2011-02-05 Thread Daniel Urban
On Sat, Feb 5, 2011 at 15:38, Steven D'Aprano wrote: > On Sat, 05 Feb 2011 14:38:29 +0100, Daniel Urban wrote: > >> On Sat, Feb 5, 2011 at 14:08, Lisa Fritz Barry Griffin >> wrote: >>> Hi there, >>> >>> How can I do this in a one liner: >>> >>>        maxCountPerPhraseWordLength = {} >>>        f

Re: Init a dictionary with a empty lists

2011-02-05 Thread Steven D'Aprano
On Sat, 05 Feb 2011 14:38:29 +0100, Daniel Urban wrote: > On Sat, Feb 5, 2011 at 14:08, Lisa Fritz Barry Griffin > wrote: >> Hi there, >> >> How can I do this in a one liner: >> >>        maxCountPerPhraseWordLength = {} >>        for i in range(1,MAX_PHRASES_LENGTH+1): >>            maxCountPerP

Re: Init a dictionary with a empty lists

2011-02-05 Thread Vlastimil Brom
2011/2/5 Lisa Fritz Barry Griffin : > Hi there, > > How can I do this in a one liner: > >        maxCountPerPhraseWordLength = {} >        for i in range(1,MAX_PHRASES_LENGTH+1): >            maxCountPerPhraseWordLength[i] = 0 > > Thanks! > -- > http://mail.python.org/mailman/listinfo/python-list >

Re: Init a dictionary with a empty lists

2011-02-05 Thread Peter Otten
Lisa Fritz Barry Griffin wrote: > How can I do this in a one liner: > > maxCountPerPhraseWordLength = {} > for i in range(1,MAX_PHRASES_LENGTH+1): > maxCountPerPhraseWordLength[i] = 0 You can init a dictionary with zeroes with d = dict.fromkeys(range(1, MAX_PHRASES_L

Re: Init a dictionary with a empty lists

2011-02-05 Thread Daniel Urban
On Sat, Feb 5, 2011 at 14:08, Lisa Fritz Barry Griffin wrote: > Hi there, > > How can I do this in a one liner: > >        maxCountPerPhraseWordLength = {} >        for i in range(1,MAX_PHRASES_LENGTH+1): >            maxCountPerPhraseWordLength[i] = 0 maxCountPerPhraseWordLength = {0 for i in ra

Re: Init a dictionary with a empty lists

2011-02-05 Thread Shashwat Anand
On Sat, Feb 5, 2011 at 6:38 PM, Lisa Fritz Barry Griffin < lisaochba...@gmail.com> wrote: > Hi there, > > How can I do this in a one liner: > >maxCountPerPhraseWordLength = {} >for i in range(1,MAX_PHRASES_LENGTH+1): >maxCountPerPhraseWordLength[i] = 0 > maxCountPerPhr

Init a dictionary with a empty lists

2011-02-05 Thread Lisa Fritz Barry Griffin
Hi there, How can I do this in a one liner: maxCountPerPhraseWordLength = {} for i in range(1,MAX_PHRASES_LENGTH+1): maxCountPerPhraseWordLength[i] = 0 Thanks! -- http://mail.python.org/mailman/listinfo/python-list