Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91603
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'error:': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'syntax': 0.13; 'output': 0.15; 'iterator': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'run:': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.16; 'string': 0.17; 'copied': 0.18; 'version.': 0.18; 'language': 0.19; '(on': 0.22; 'assuming': 0.22; 'fixing': 0.22; 'lawrence': 0.22; '2015': 0.23; 'specified': 0.23; 'header :In-Reply-To:1': 0.24; 'tim': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'coded': 0.29; 'colon': 0.29; 'e.g.': 0.31; 'print': 0.31; 'language.': 0.32; 'subject:use': 0.33; 'to:addr:python-list': 0.35; 'something': 0.35; 'but': 0.36; 'statement': 0.36; 'hi,': 0.37; 'subject:: ': 0.37; 'received:org': 0.38; 'end': 0.39; 'means': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'mark': 0.40; 'back': 0.61; 'hope': 0.61; 'per': 0.61; 'above,': 0.63; 'complete': 0.63; 'our': 0.64; 'charset:windows-1252': 0.65; 'delaney': 0.84; 'pythonistas,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: What use for reversed()? |
| Date | Mon, 01 Jun 2015 01:30:40 +0100 |
| References | <514c05fc-dded-4278-ac86-3e8e3cd0e851@googlegroups.com> <CAN8CLgnm3ZVzzZHB4306nQdKh3Xwu8fBpL25P1Cy1+0EpvG=6g@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-78-147-177-12.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| In-Reply-To | <CAN8CLgnm3ZVzzZHB4306nQdKh3Xwu8fBpL25P1Cy1+0EpvG=6g@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.255.1433121593.5151.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433121593 news.xs4all.nl 2963 [2001:888:2000:d::a6]:46553 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91603 |
Show key headers only | View raw
On 01/06/2015 00:23, Tim Delaney wrote: > On 1 June 2015 at 05:40, fl <rxjwg98@gmail.com > <mailto:rxjwg98@gmail.com>> wrote: > > Hi, > > I have a string b='1234'. I run: br=reversed(b) > > I hope that I can print out '4321' by: > > for br in b > > but it complains: > SyntaxError: invalid syntax > > > Any time you get a SyntaxError, it means that you have coded something > which does not match the specified syntax of the language version. > > Assuming you copied and pasted the above, I can see an error: > > for br in b > > The for statement must have a colon at the end of line e.g. a complete > for statement and block is: > > for br in b: > print br > > This will output the characters one per line (on Python 3.x), since that > is what the reversed() iterator will return. You will need to do > something else to get it back to a single string. Will it indeed? Perhaps fixing the syntax error will get something to print :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 12:40 -0700
Re: What use for reversed()? Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-31 19:58 +0000
Re: What use for reversed()? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-31 18:06 -0600
Re: What use for reversed()? cheshire <supportNOSPAM@microsoft.com> - 2015-05-31 23:26 +0200
Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 09:23 +1000
Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 20:11 -0700
Re: What use for reversed()? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-01 01:30 +0100
Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 13:59 +1000
Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 22:15 -0700
Re: What use for reversed()? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-01 09:11 +0300
csiph-web