naming objects from string
wildemar at freakmail.de
Thu Sep 21 06:59:05 CEST 2006
> But this doesn't work if I do:
> locals()[x] = a
> How can I do this?
You can. I just copy/pasted your code and it works fine here. (You are
aware that there is whitespace before locals() that you have to remove
before you feed it to the snake?)
What error did you get?
Let me again stress that using locals and globals is a bit contrived,
whereas the dictionary approach from my other post is not.
Just out of curiosity: Why do you want to do this anyway?
More information about the Python-list