An extraordinarily stupid question
Marc Poulin
mpoulin at verinet.com
Sat Apr 20 23:50:50 EDT 2002
In article <3CC0D892.2060006 at nyu.edu>, "Shane Hoversten" <srh232 at nyu.edu>
wrote:
> Hi -
>
> This is really dumb, but I just want to print out a character without a
> newline and without a space behind it. You can't do:
>
> print c,
>
> Because Python puts a space behind it. I can't find anywhere in the
> dox
> that actually talk about "print" in any detail at all. Surely there
> must be some way to do this?
>
> Thanks,
>
> Shane
Not dumb at all. Here is some documentation on "print".
Note the rules about when the space is printed.
http://www.python.org/doc/current/ref/print.html#l2h-330
Try writing to stdout directly.
>>> def print_a():
sys.stdout.write("a")
>>> def print_b():
sys.stdout.write("b")
>>> def print_ab():
print_a()
print_b()
>>> print_ab()
ab
>>>
More information about the Python-list
mailing list