Python: load variables in a dict into namespace

Posted by celil on Stack Overflow See other posts from Stack Overflow or by celil
Published on 2010-04-08T02:50:31Z Indexed on 2010/04/08 2:53 UTC
Read the original article Hit count: 386

Filed under:
|
|

I want to use a bunch of local variables defined in a function, outside of the function, so I am passing x=locals() as a return value. How can I load all the variables defined in that dictionary into the namespace outside the function, so that instead of accessing the value using x['variable'], I could simply use variable.

© Stack Overflow or respective owner

Related posts about python

Related posts about locals