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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TP

    #1

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

    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

    #2
    Re: how to avoid line return when using python -c 'print "foo" '

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

    Ciao,
    Marc 'BlackJack' Rintsch

    Comment

    Working...