Append data to a list within a dict

Paul Rubin http
Sat Apr 14 07:51:42 CEST 2007


Tina I <tinaweb at bestemselv.com> writes:
> ListDict = {
> 'one' : ['oneone' , 'onetwo' , 'onethree'],
> 'two' : ['twoone' , 'twotwo', 'twothree'],
> 'three' : ['threeone' , 'threetwo', threethree']}
> 
> Now I want to append 'twofour' to the list of the 'two' key but I
> can't figure out how to that?

Is this a class exercise?  Hint:
  1) figure out how to access the list of the 'two' key
  2) append 'twofour' to it.



More information about the Python-list mailing list