How to write a simple shell loop in python?

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jan 21 00:42:16 EST 2009


Dietrich Bollmann <diresu at web.de> writes:

> I am trying to write a simple shell loop in Python.

You should investigate the ‘cmd’ module in the standard library
<URL:http://docs.python.org/library/cmd.html>.

> My simple approach works fine - but the first output line after
> entering something is always indented by one blank.

You should investigate the meaning of a comma ‘,’ in the ‘print’
statement (hint: it can affect subsequent ‘print’ statements)
<URL:http://docs.python.org/reference/simple_stmts.html#the-print-statement>.

-- 
 \       “Anyone who puts a small gloss on [a] fundamental technology, |
  `\          calls it proprietary, and then tries to keep others from |
_o__)           building on it, is a thief.” —Tim O'Reilly, 2000-01-25 |
Ben Finney



More information about the Python-list mailing list