Dynamic list name from a string

Andre Alexander Bell post at andre-bell.de
Mon Dec 20 05:33:56 EST 2010


Hello,

On 12/20/2010 11:08 AM, MarcoS wrote:
> Hi, I need to create a list with a dynamic name, something like this:
> 
> '%s_list' %my_dynamic list = []
> 
> It's this possible?

I would suggest you use a dictionary to store your lists like this:

lists = {}

lists[my_dynamic_list] = []

Maybe you tell us some more what you want to achieve...

Regards


Andre



More information about the Python-list mailing list