Creating interactive command-line Python app?

Steve Holden steve at holdenweb.com
Wed Dec 21 07:58:40 EST 2005


planetthoughtful wrote:
> Hello All,
> 
> Newbie to Python, and I'm wondering if it's possible to create a Python
> console app that prompts for further input on the command line when run
> (in Windows XP, if that's important)?
> 
> I've tried Googling, but the results are overwhelmingly about
> interactive Python environments (IPython etc etc), instead of how to
> achieve prompting at the command line when running your own Python app.
> 
> Any help appreciated!
> 
> Much warmth,
> 
> planetthoughtful
> 
Yes. Look at the raw_input() function:

  >>> result = raw_input("What can I do for you? ")
What can I do for you? Something
  >>> result
'Something'
  >>>

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list