How avoid both a newline and a space between 2 print commands?

S

seberino

print "foo"
print "bar"

has a newline in between "foo" and "bar"

print "foo",
print "bar"

has a space in between "foo" and "bar"

How prevent ANYTHING from going in between "foo" and "bar" ??

(Without defining a string variable.)

Chris
 
D

Diez B. Roggisch

print "foo"
print "bar"

has a newline in between "foo" and "bar"

print "foo",
print "bar"

has a space in between "foo" and "bar"

How prevent ANYTHING from going in between "foo" and "bar" ??

(Without defining a string variable.)

sys.stdout.write("foo")
sys.stdout.write("bar")

Diez
 
M

Mike Kent

print "foo"
print "bar"

has a newline in between "foo" and "bar"

print "foo",
print "bar"

has a space in between "foo" and "bar"

How prevent ANYTHING from going in between "foo" and "bar" ??

(Without defining a string variable.)

Chris

print "%s%s" % ("foo", "bar") ## If "%s%s" doesn't violate your
condition of not defining a string variable, I'm not sure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top