Paramaterized local variable name

Tim Cera timcera at earthlink.net
Sun Dec 30 15:34:52 CET 2001


Hans Nowak <wurmy at earthlink.net> wrote
> You probably want
> 
>   start = getattr(data[key][i], local_name)
> 
> Now you can set local_name to a string "name" or "rev"
> or whatever attribute of data[key][i] you want to
> access.

Works great!

THANKS!

Thanks also to Sean for the 'exec' based solution.

take care
Tim Cera



More information about the Python-list mailing list