Using String for new List name

Ethan Furman ethan at stoneleaf.us
Mon Sep 28 14:15:44 EDT 2009


Scott wrote:
> Thank you fine folks for getting back with your answers!
> 
> So down the road I do dictname[line42].append("new stuff"). (or [var]
> if I'm looping through the dict)
> 
> This is cool and should do the trick!
> 
> -Scott Freemire
> disclosure - Ok, I'm new to *any* language. I've been teaching myself
> for about 3 months with "Learning Python, 3rd Edition" and I think
> it's going well! Of course I picked something way too complicated for
> a first try. Thanks again!

That should actually be dictname["line42"].append("new stuff").  Notice 
the quotes around line42.

Good luck!  Python is a fine language, I hope you like it.

~Ethan~



More information about the Python-list mailing list