General question re: print statement

Justin Sheehy dworkin at ccs.neu.edu
Tue May 9 12:47:39 EDT 2000


chibaA at TinterlogD.Tcom writes:

> The basic point of this code above - is the print<<"(WHATEVER)"; part
> of it --> whatever is between the (WHATEVER)s, can be free form text
> which will just be outputted as is (with the spaces, new lines, etc).
> And I don't have to use escape characters to output reserved
> characters.
> 
> Does anyone know if this is possible - or how to do this in Python?

Use triple quotes.

>>> print """spam
... eggs
... spam 
...   more spam
... """
spam
eggs
spam
  more spam

>>> 

-Justin

 




More information about the Python-list mailing list