Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48370
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joshua.landau.ws@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.060 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.01; 'string': 0.09; 'lawrence': 0.09; 'cc:addr:python-list': 0.11; '"by': 0.16; '"in': 0.16; 'a.py': 0.16; 'subject:Regular': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'tend': 0.24; 'cc:2**0': 0.24; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'received:209.85.217': 0.29; 'message-id:@mail.gmail.com': 0.30; 'you?': 0.31; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'rather': 0.38; 'new': 0.61; 'reach': 0.63; 'subject:Search': 0.84; 'to:addr:yahoo.co.uk': 0.84; 'careful': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9Pm59MODT4mIeRgay0R/2cok1NplG9zbUUfKI/fMq7M=; b=CBLlJGAd4Fh0GQK63eVcFWIotAkEn5LOjQZPRwHX6mONj738psQfyR8bu5y/EN+jTx FVwUQW6pvptmmR092jG8SR46SwWXHeAaHn/VNyNjlbr8PYWYzRd1iG+IgCvIA2MnXDLY nKpaRliTTYyaRZOipwx5A1x+4He1Cfwz5yR+Ygb1UtVL6OIRa1OosfiQw+dyf/Jl+Xlg ZcBDfbKy7j795fkgr0DYp6DjiZbCc5rYm6/ijcd/6CgQTrj4L1hnyoGCGXRqFje1AcjS /eg/F0XFsrwbCHQSgSHsTMcOJGbZQBuLJneZdC0bhJ5IqbYrrX0TmxJp3C/CqZWL7Hon xpWQ== |
| X-Received | by 10.112.5.199 with SMTP id u7mr3525787lbu.67.1371330239759; Sat, 15 Jun 2013 14:03:59 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <kphf0l$qla$1@ger.gmane.org> |
| References | <afd6b280-3b64-467b-a2e1-2b36377cd13a@googlegroups.com> <kphf0l$qla$1@ger.gmane.org> |
| From | Joshua Landau <joshua.landau.ws@gmail.com> |
| Date | Sat, 15 Jun 2013 22:03:19 +0100 |
| Subject | Re: Pattern Search Regular Expression |
| To | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list <python-list@python.org> |
| 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.3409.1371330247.3114.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1371330247 news.xs4all.nl 16010 [2001:888:2000:d::a6]:44735 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:48370 |
Show key headers only | View raw
On 15 June 2013 11:18, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> I tend to reach for string methods rather than an RE so will something like
> this suit you?
>
> c:\Users\Mark\MyPython>type a.py
> for s in ("In the ocean",
> "On the ocean",
> "By the ocean",
> "In this group",
> "In this group",
> "By the new group"):
> print(' '.join(s.split()[1:-1]))
>
>
> c:\Users\Mark\MyPython>a
> the
> the
> the
> this
> this
> the new
Careful - " ".join(s.split()) != s
Eg:
>>> " ".join("s\ns".split())
's s'
It's pedantry, but true.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 02:42 -0700
Re: Pattern Search Regular Expression Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-15 10:05 +0000
Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 10:24 +0000
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 11:55 +0100
Re: Pattern Search Regular Expression rusi <rustompmody@gmail.com> - 2013-06-15 04:28 -0700
Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 13:41 +0000
Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 13:45 +0000
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 15:28 +0100
Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 07:31 -0700
Re: Pattern Search Regular Expression Andreas Perstinger <andipersti@gmail.com> - 2013-06-15 17:01 +0200
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 16:04 +0100
Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 09:28 -0700
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 17:39 +0100
Re: Pattern Search Regular Expression Terry Reedy <tjreedy@udel.edu> - 2013-06-15 16:24 -0400
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 11:18 +0100
Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 09:59 -0700
Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 10:54 -0700
Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 11:47 -0700
Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 12:38 -0700
Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 13:41 -0700
Re: Pattern Search Regular Expression Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-15 22:03 +0100
Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 22:26 +0100
csiph-web