[Tutor] variable from input?

Liam Clarke cyresse at gmail.com
Tue Oct 26 02:12:24 CEST 2004


That's an interesting one... 

You could have the variable contained in a separate module, and then
when the user enters the variable name, have another function write
that variable name throughout the other module, and then reimport the
other module, but that would only work if the variable were entirely
contained within that module.

But I've wondered that myself, but the implementation doesn't seem to
be worth the effort.
Once again, I could be entirely wrong.

Liam


On Mon, 25 Oct 2004 19:53:22 -0400, Rene Lopez <renx99 at gmail.com> wrote:
> is it possible to have the user input something with a raw_input
> command, and then base upon the input make that into the name of a
> variable?
> 
> for example:
> 
> answer = raw_input("what is your name?")
> 
> user types in Rene, and some how we end up with a variable named Rene?
> --
> 
> Rene
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list