Entry
print "foo", without a space
Jul 5th, 2000 10:02
Nathan Wallace, Hans Nowak, Snippet 276, Tim Peters
"""
Packages: miscellaneous
"""
"""
> Is there another way of getting print to not make a newline than
> using:
> print "foo", ?
No.
> This because the comma always produces a space which necessary
> isn't that nice ...
That's a different issue than newlines. In small doses, this devious
trick is quite pleasant:
"""
import sys
def no_space_before(x):
sys.stdout.softspace = 0
return x
ns = no_space_before
print 1, ns(2), 3, ns(4), 5
# 12 34 5
"""
the-great-thing-about-python-is-it's-so-obvious<wink>-ly y'rs - tim
"""