[Tutor] secondary prompt
Michael P. Reilly
arcege@shore.net
Fri, 7 Apr 2000 22:43:39 -0400 (EDT)
> when entering code in interactive mode, how do you tell the interpreter =
> that the next line is a continuation (and have it display the secondary =
> prompt), rather than a new line?
There are three basic times when you will get a secondary prompt.
1. when you explicitly add a line continuation with a backslash (\):
>>> print "The Knights who " + \
... "say Ni!"
(reference: Python Language Reference, 2.1.4 Explicit line joining)
2. when various forms of parentheses are incomplete:
>>> print ("The Knights who " +
... "say Hi!")
>>> a = {
... 'spam': 'eggs'
... }
(reference: Python Language Reference, 2.1.5 Implicit line joining)
3. when Python's syntax demands it, with multi-line statements:
>>> if 1:
... pass
this will be most lines that end with ":"
(reference: Python Language Reference, 7. Compound statements)
Enjoy,
-Arcege
--
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net |
| Salem, Mass. USA 01970 | |
------------------------------------------------------------------------