Connecting Tech Pros Worldwide Help | Site Map

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

TP
Guest
 
Posts: n/a
#1: Jul 18 '08
Hi everybody,

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".

Thanks in advance

Julien

--
TP (Tribulations Parallèles)

"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).
Marc 'BlackJack' Rintsch
Guest
 
Posts: n/a
#2: Jul 18 '08

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


On Fri, 18 Jul 2008 23:04:06 +0200, TP wrote:
Quote:
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``.

Ciao,
Marc 'BlackJack' Rintsch
Closed Thread