Entry
Is there any way to use consecutive print statements?
May 15th, 2000 06:02
unknown unknown, Courageous, Fredrik Lundh, Cliff Crawford
Here's one way:
print "This is a test of the emergency broadcast system\n" \
"This is only a test. Had this been an actual\n" \
"emergency, you would have been given instructions\n" \
"on where to go and what to do.
Here's another way:
print "Guten tag! Ich heisse \"%s\", and ich bin von\n" \
"Dresden. Ich habe %d jaren, und Ich grosse %3.1f\n" \
"kilogramme. Anschildegung. Meine Deustch ist nicht\n" \
"so gut." % ( "Josef", 33, 85.3 )
And yet another way:
print "This is"+" a test"+" of string concatenation, "+ \
"which can be very expensive."
Note that the % operator isn't just for print. For example, you
do something like:
str = "Hi, my name is \"%s\"" % "Fred"
And then, how about:
import sys
write = sys.stdout.write
write("sp")
write("am")