print "foo", without a space
mikael.johansson at helsinki.xx
Thu Nov 11 09:33:31 EST 1999
Is there another way of getting print to not make a newline than
print "foo", ?
This because the comma always produces a space which necessary
isn't that nice, for example:
for i in range (1,30):
if i%10==1 and i<>11: print "st",
elif i%10==2 and i<>12: print "nd",
elif i%10==3 and i<>13: print "rd",
else: print "th",
Now you would like the "endings" to come right after the number.
There is naturally always some way to get around this, in this
case for example:
for i in range(1,30):
OK, this got a bit out of hand, the above looks terrible, does
anyone see how it could be simplified? At least it's more general
than the above as it can handle the whole range of integers,
including negative ones :-) However it shows that it would be
less obfuscating to have a print statement that could continue
printing on the same line without a space.
If there isn't an easy way for this, I suggest the following:
So that a dot at the end of the line would mean "no space either".
Appreciating any comments.
Have a nice day,
for e-mail note that the country code for Finland is not xx
More information about the Python-list