print with no newline
exarkun at divmod.com
Fri Sep 3 16:08:08 CEST 2004
Paul Watson wrote:
> I thought that using a comma at the end of a print statement would suppress
> printing of a newline. Am I misunderstanding this feature? How can I use
> print and not have a newline appended at the end?
Print doesn't want to leave the *final* line without a newline.
sys.stdout.write() doesn't care if your shell prompt gets mixed in with
the last line of output. You'll need to use the latter if that's what
exarkun at boson:~$ python -c "import sys; sys.stdout.write('here')"
hereexarkun at boson:~$
More information about the Python-list