Re: appending key-value pairs to a dict

2005-05-20 Thread rbt
Peter Hansen wrote: > rbt wrote: > >> I know how to setup an empty list and loop thru something... appending >> to the list on each loop... how does this work with dicts? >> >> I'm looping thru a list of files and I want to put the file's name and >> its sha hash into a dict on each loop. > >

Re: appending key-value pairs to a dict

2005-05-20 Thread Roy Smith
rbt <[EMAIL PROTECTED]> wrote: >I know how to setup an empty list and loop thru something... appending >to the list on each loop... how does this work with dicts? > >I'm looping thru a list of files and I want to put the file's name and >its sha hash into a dict on each loop. You just assign va

Re: appending key-value pairs to a dict

2005-05-20 Thread James Stroud
On Friday 20 May 2005 01:04 pm, rbt wrote: > I know how to setup an empty list and loop thru something... appending > to the list on each loop... how does this work with dicts? > > I'm looping thru a list of files and I want to put the file's name and > its sha hash into a dict on each loop. > > Ma

Re: appending key-value pairs to a dict

2005-05-20 Thread Brian Beck
rbt wrote: > I know how to setup an empty list and loop thru something... appending > to the list on each loop... how does this work with dicts? > > I'm looping thru a list of files and I want to put the file's name and > its sha hash into a dict on each loop. Like so: d = {} for filename in f

Re: appending key-value pairs to a dict

2005-05-20 Thread Peter Hansen
rbt wrote: > I know how to setup an empty list and loop thru something... appending > to the list on each loop... how does this work with dicts? > > I'm looping thru a list of files and I want to put the file's name and > its sha hash into a dict on each loop. Whereas with a list you would call

appending key-value pairs to a dict

2005-05-20 Thread rbt
I know how to setup an empty list and loop thru something... appending to the list on each loop... how does this work with dicts? I'm looping thru a list of files and I want to put the file's name and its sha hash into a dict on each loop. Many thanks, rbt -- http://mail.python.org/mailman/li