Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54081

Re: print function and unwanted trailing space

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <marduk@letterboxes.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:internal': 0.09; 'better:': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:compute4.internal': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'wayne': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'meant': 0.20; 'aug': 0.22; 'define': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "skip:' 10": 0.31; 'sep': 0.31; 'received:66': 0.35; 'something': 0.35; 'skip:- 20': 0.37; 'received:10': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'header:Message-Id:1': 0.63; 'subject:space': 0.84; '2013,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=letterboxes.org; h=message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= knHqGURtNYhf3rdxND74NuQyoHc=; b=dqQA71tGi6cO5nv7QQTaRXTf45qMPRrM QLPxrM4N5Xzk4s68LB6UD9glSDCvMlE2i2t1iK6yW5dPb8+KF5bGQwXUwK9BJyln lK5mJ9TwwC6Gy+emUfoc0RmN/fm9rXNUcYqyW2ZWYUDeqhWyukWm9nD/XO0k27hY Kaeeu1qZkjY=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=knHqGURtNYhf3rdxND74NuQyoHc=; b=TH/ 9cLryOlvXSx73BA9ohfKGaB7KsZ0FrXu5eISVtCA8nlGGu/8/70XF/q4NZ5Q7ZMe Z09PSGps7eyVVnDpc27trErG0hgcCIdVdLNxNsAC51YZkuUnZuCY9590kwvqqOY/ JcXR1l1S8JeW2lkuyENt+4ugHN+UIyDqCurrTVDA=
X-Sasl-Enc NfObdJPO3WKt05h7WgfQgbIS5a9VR4CRtYw3T4GdEEte 1379013930
From Albert Hopkins <marduk@letterboxes.org>
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-d310b333
In-Reply-To <alpine.DEB.2.02.1309110635370.2301@gilgamesh>
References <5221a693$0$2059$426a74cc@news.free.fr> <alpine.DEB.2.02.1309110635370.2301@gilgamesh>
Subject Re: print function and unwanted trailing space
Date Thu, 12 Sep 2013 15:25:30 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.327.1379013943.5461.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1379013943 news.xs4all.nl 16008 [2001:888:2000:d::a6]:44574
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:54081

Show key headers only | View raw



On Wed, Sep 11, 2013, at 07:36 AM, Wayne Werner wrote:
> On Sat, 31 Aug 2013, candide wrote:
> > # -----------------------------
> > for i in range(5):
> >    print(i, end=' ')   # <- The last ' ' is unwanted
> > print()
> > # -----------------------------
> 
> Then why not define end='' instead?

I think the OP meant that ' ' is wanted up until the final item.. so
something like

for i in range(4):
    print(i, end=' ')
print(4)

or, better:
print(' '.join(str(i) for i in range(5)))

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 10:17 +0200
  Re: print function and unwanted trailing space Andreas Perstinger <andipersti@gmail.com> - 2013-08-31 10:43 +0200
    Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 11:25 +0200
      Re: print function and unwanted trailing space Peter Otten <__peter__@web.de> - 2013-08-31 12:31 +0200
        Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 15:33 +0200
          Re: print function and unwanted trailing space Peter Otten <__peter__@web.de> - 2013-08-31 15:59 +0200
            Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 17:58 +0200
          Re: print function and unwanted trailing space Chris Angelico <rosuav@gmail.com> - 2013-09-01 01:30 +1000
          Re: print function and unwanted trailing space Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-08-31 16:43 +0100
          Re: print function and unwanted trailing space Chris Angelico <rosuav@gmail.com> - 2013-09-01 08:08 +1000
          Re: print function and unwanted trailing space Joshua Landau <joshua@landau.ws> - 2013-09-01 00:15 +0100
          Re: print function and unwanted trailing space Terry Reedy <tjreedy@udel.edu> - 2013-08-31 19:57 -0400
        Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 17:51 +0200
  Re: print function and unwanted trailing space Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-31 11:16 +0000
    Re: print function and unwanted trailing space Peter Otten <__peter__@web.de> - 2013-08-31 14:27 +0200
    Re: print function and unwanted trailing space Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-08-31 13:37 +0100
    Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 14:59 +0200
      Re: print function and unwanted trailing space Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-31 15:18 +0000
  Re: print function and unwanted trailing space Ned Batchelder <ned@nedbatchelder.com> - 2013-08-31 07:24 -0400
    Re: print function and unwanted trailing space candide <candide@free.invalid> - 2013-08-31 15:51 +0200
  Re: print function and unwanted trailing space Wayne Werner <wayne@waynewerner.com> - 2013-09-11 06:36 -0500
  Re: print function and unwanted trailing space Albert Hopkins <marduk@letterboxes.org> - 2013-09-12 15:25 -0400

csiph-web