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


Groups > comp.lang.python > #53335 > unrolled thread

print function and unwanted trailing space

Started bycandide <candide@free.invalid>
First post2013-08-31 10:17 +0200
Last post2013-09-12 15:25 -0400
Articles 2 on this page of 22 — 11 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#53951

FromWayne Werner <wayne@waynewerner.com>
Date2013-09-11 06:36 -0500
Message-ID<mailman.240.1378899450.5461.python-list@python.org>
In reply to#53335
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?

-W

[toc] | [prev] | [next] | [standalone]


#54081

FromAlbert Hopkins <marduk@letterboxes.org>
Date2013-09-12 15:25 -0400
Message-ID<mailman.327.1379013943.5461.python-list@python.org>
In reply to#53335

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)))

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web