Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48274 > unrolled thread
| Started by | subhabangalore@gmail.com |
|---|---|
| First post | 2013-06-15 02:42 -0700 |
| Last post | 2013-06-15 22:26 +0100 |
| Articles | 2 on this page of 22 — 9 participants |
Back to article view | Back to comp.lang.python
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
Page 2 of 2 — ← Prev page 1 [2]
| From | Joshua Landau <joshua.landau.ws@gmail.com> |
|---|---|
| Date | 2013-06-15 22:03 +0100 |
| Message-ID | <mailman.3409.1371330247.3114.python-list@python.org> |
| In reply to | #48274 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-06-15 22:26 +0100 |
| Message-ID | <mailman.3411.1371331591.3114.python-list@python.org> |
| In reply to | #48274 |
On 15/06/2013 22:03, Joshua Landau wrote:
> 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.
>
I'm sorry but I haven't the faintest idea what you're talking about. I
believe the code I posted works for the OP's needs. If it doesn't
please say so.
--
"Steve is going for the pink ball - and for those of you who are
watching in black and white, the pink is next to the green." Snooker
commentator 'Whispering' Ted Lowe.
Mark Lawrence
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.python
csiph-web