I am implementing a small command line tool in python that needs to ask the user a couple of questions. I use
raw_input(\'Are you male or female?\') <
raw_input(\'Are you male or female?\')
From the accepted answer to this question: the cmd library might be of interest to you.
"The Cmd class provides a simple framework for writing line-oriented command interpreters."
This Python Module of the Week page features it, and it has some examples and explanations.