how to avoid line return when using python -c 'print "foo"'

Marc 'BlackJack' Rintsch bj_666 at
Fri Jul 18 23:15:15 CEST 2008

On Fri, 18 Jul 2008 23:04:06 +0200, TP wrote:

> All my problem is in the title.
> If I try:
> $ python -c 'print "foo",'
> It does not change anything, surely because the line return is added
> by "python -c".

It is added by the interpreter at exit time.  The interpreter tries to be
smart here deciding for you that the last printed line before program exit
should end in a newline.  Use `sys.write()` instead of ``print``.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list