Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94130
| Return-Path | <python@mrabarnett.plus.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'string.': 0.04; 'indexing': 0.07; 'oh,': 0.09; 'elements,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'function).': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'pythonistas': 0.16; 'received:192.168.1.4': 0.16; 'reversed': 0.16; 'subject:assistance': 0.16; 'sublist': 0.16; 'used:': 0.16; 'wrote:': 0.16; 'string': 0.17; 'element': 0.18; '>>>': 0.20; '2015': 0.20; 'code,': 0.23; 'daniel': 0.23; 'elements': 0.23; 'sat,': 0.23; 'split': 0.23; 'words': 0.24; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'order.': 0.27; '+0200,': 0.27; 'function': 0.28; 'necessary,': 0.29; 'probably': 0.31; 'another': 0.32; 'help,': 0.32; 'possibly': 0.32; 'maybe': 0.33; 'list': 0.34; 'but': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'method': 0.37; 'desired': 0.37; "won't": 0.38; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'subject:Need': 0.61; 'reverse': 0.66; 'here': 0.66; 'jul': 0.72; 'denis': 0.84; 'easier,': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=JOrGyJ+b c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=JAI3OqB5mnwA:10 a=IkcTkHD0fZMA:10 a=sXHA8oGle9sPoosKW4EA:9 a=QEXdDO2ut3YA:10 |
| X-AUTH | mrabarnett@:2500 |
| Subject | Re: Need assistance |
| To | python-list@python.org |
| References | <225d4ac6-3b88-4844-805b-b4b00cd62ef4@googlegroups.com> <moc7aa$geg$1@dont-email.me> <mailman.675.1437215723.3674.python-list@python.org> <moesp6$e2m$1@dont-email.me> |
| From | MRAB <python@mrabarnett.plus.com> |
| Date | Sun, 19 Jul 2015 17:35:03 +0100 |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
| MIME-Version | 1.0 |
| In-Reply-To | <moesp6$e2m$1@dont-email.me> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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.724.1437323706.3674.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1437323706 news.xs4all.nl 2840 [2001:888:2000:d::a6]:37579 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:94130 |
Show key headers only | View raw
On 2015-07-19 01:59, Denis McMahon wrote: > On Sat, 18 Jul 2015 12:35:10 +0200, Sibylle Koczian wrote: > >> Am 18.07.2015 um 02:40 schrieb Denis McMahon: > >>> Having a list of words, get a copy of the list in reverse order. See >>> the reversed function (and maybe the list function). > >> That won't really help, because the desired order is, with the example >> the OP used: Sirna Daniel Craig. So here indexing is necessary, but >> indexing of the list elements, not of the characters in the string. > > Oh, then it's even easier, yes, it's mainly a case of list indexing. > > 1) Split the original string into a list of words (string.split() method) > 2) create a sublist (s1) of the last element > 3) create another sublist (s2) of the first to penultimate elements > 4) combine the two sublists > 5) use the string.join() method to combine the sublist elements into a > single string > > I think most pythonistas would probably combine steps 2 through 4 in a > single line of code, possibly even steps 2 through 5. > If you use rsplit, you can do it in one line.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need assistance craig.sirna@gmail.com - 2015-07-16 19:15 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-16 20:40 -0600
Re: Need assistance craig.sirna@gmail.com - 2015-07-16 20:00 -0700
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-16 20:12 -0700
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-16 19:44 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-16 21:00 -0600
Re: Need assistance Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-07-17 16:40 +0000
Re: Need assistance Igor Korot <ikorot01@gmail.com> - 2015-07-17 12:54 -0400
Re: Need assistance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-17 20:00 +0100
Re: Need assistance Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-18 00:40 +0000
Re: Need assistance Sibylle Koczian <nulla.epistola@web.de> - 2015-07-18 12:35 +0200
Re: Need assistance Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-19 00:59 +0000
Re: Need assistance MRAB <python@mrabarnett.plus.com> - 2015-07-19 17:35 +0100
flipping string order Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-19 18:06 +0000
Re: Need assistance Laura Creighton <lac@openend.se> - 2015-07-18 14:16 +0200
RE: Need assistance "Joseph Lee" <joseph.lee22590@gmail.com> - 2015-07-18 09:05 -0700
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 12:18 -0400
Re: Need assistance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-18 18:34 +0100
Re: Need assistance mm0fmf <none@mailinator.com> - 2015-07-18 19:51 +0100
Re: Need assistance Joel Goldstick <joel.goldstick@gmail.com> - 2015-07-18 15:10 -0400
Re: Need assistance mm0fmf <none@mailinator.com> - 2015-07-18 20:35 +0100
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 17:44 -0400
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-18 20:46 -0600
Re: Need assistance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-07-18 17:34 -0400
Re: Need assistance William Ray Wing <wrw@mac.com> - 2015-07-18 14:28 -0400
Re: Need assistance MRAB <python@mrabarnett.plus.com> - 2015-07-19 01:14 +0100
Re: Need assistance craig.sirna@gmail.com - 2015-07-19 16:06 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-19 17:56 -0600
Re: Need assistance Rick Johnson <rantingrickjohnson@gmail.com> - 2015-07-19 17:21 -0700
Re: Need assistance Michael Torrie <torriem@gmail.com> - 2015-07-19 23:16 -0600
Re: Need assistance Chris Angelico <rosuav@gmail.com> - 2015-07-20 15:25 +1000
csiph-web