Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53343
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nedbat@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.030 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'anyway.': 0.05; 'beginner': 0.05; 'trailing': 0.09; 'python': 0.11; "wouldn't": 0.14; 'comma': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'print': 0.22; 'header:User-Agent:1': 0.23; 'equivalent': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'code': 0.31; 'fine,': 0.31; 'obscure': 0.31; "they'll": 0.31; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'skip:- 20': 0.37; 'to:addr:python- list': 0.38; 'list,': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'skip:u 10': 0.60; 'strictly': 0.61; 'advanced': 0.63; 'details': 0.65; 'subject:space': 0.84; 'careful': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=NW4YhFNi9T1hvnLAkH+0qY44Ruj2vE81//m87UkLc8s=; b=FXJGjQWLfnJwInmEtRaJ1TIzQpTOfWgTvaCMX1cEwvv9mtitgVC91BpRqdf6D9ArlG r807csYQAF4C1TnMHnKs3ohaKIim6PJB/knzwaO/e/thtTRCBFl2C2uwqis5UrtD1rtq 9iHLizeUmJmKedpV71uyt0fh6uyiDsaN4SiAARLftK6dzNHq1Chbt2kbqNDnnBuBW1gq Myvl5avbBsvV00LN+kPrvRq0XkL23+///P2AutjK2DoNIoB30EzJXDwUtSrgbRNXZ+Jg ELorNblkAt3HmXoUMP/EyTBvLMq+p8tGRkWniNB0y2otC5NyA/lT+QnvnH76OJUBl7Z3 RY4w== |
| X-Received | by 10.49.6.99 with SMTP id z3mr16855450qez.27.1377948295410; Sat, 31 Aug 2013 04:24:55 -0700 (PDT) |
| Sender | Ned Batchelder <nedbat@gmail.com> |
| Date | Sat, 31 Aug 2013 07:24:54 -0400 |
| From | Ned Batchelder <ned@nedbatchelder.com> |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: print function and unwanted trailing space |
| References | <5221a693$0$2059$426a74cc@news.free.fr> |
| In-Reply-To | <5221a693$0$2059$426a74cc@news.free.fr> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.407.1377948297.19984.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377948297 news.xs4all.nl 16007 [2001:888:2000:d::a6]:37127 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53343 |
Show key headers only | View raw
On 8/31/13 4:17 AM, candide wrote: > > What is the equivalent in Python 3 to the following Python 2 code: > > # ----------------------------- > for i in range(5): > print i, > # ----------------------------- > > ? > > Be careful that the above code doesn't add a trailing space after the > last number in the list, hence the following Python 3 code isn't > strictly equivalent: > > > # ----------------------------- > for i in range(5): > print(i, end=' ') # <- The last ' ' is unwanted > print() > # ----------------------------- For a beginner course, the trailing space is fine, use this code. They'll never notice the trailing space (I wouldn't have!) and to explain why the comma leaves off the last one takes a really advanced understanding of obscure details anyway. --Ned.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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