like you learned a lot!
Marilyn Davis
> set of special words and then checked if each word in the text belonged
> to the set of special words. If we assume that the list of special words
> doesn't exist then the problem is interesting in itself to solve.
>
> Cheers!
>
>
On Tue, Jun 3, 2008 at 5:13 AM, Dinesh B Vadhia
<[EMAIL PROTECTED]> wrote:
> Yes, I'm happy because I found a non-regex way to solve the problem (see
> below).
> How did I solve it? I found a list of all the special words, created a set
> of special words and then checked if each word in the text
solve it? I found a list of all the special words, created a set of
special words and then checked if each word in the text belonged to the set of
special words. If we assume that the list of special words doesn't exist then
the problem is interesting in itself to solve.
Cheers!
Dinesh
Hi,
Try the partition(sep) and rpartition(sep) in a loop. See:
http://www.python.org/doc/2.5/whatsnew/other-lang.html
Could be funny. Regards,
Santiago
On Sun, 1 Jun 2008 03:48:06 -0700 "Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote:
> A text document has special character strings defined as "."
On Sun, Jun 1, 2008 at 9:41 PM, Marilyn Davis <[EMAIL PROTECTED]> wrote:
> Yeh, we need a better spec. I was wondering if the stuff between the text
> ought not include white space, or even a word boundary. A character class
> might be better, if we knew.
Hmm, yes, my regex will find many ordina
On Sun, June 1, 2008 4:58 pm, Kent Johnson wrote:
> On Sun, Jun 1, 2008 at 2:04 PM, Marilyn Davis <[EMAIL PROTECTED]>
> wrote:
>
>> On Sun, June 1, 2008 10:30 am, Alan Gauld wrote:
>>
>>
>>> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>>>
>>>
>>>
Assuming the strings are non-overlapping, i.e. th
On Sun, Jun 1, 2008 at 2:04 PM, Marilyn Davis <[EMAIL PROTECTED]> wrote:
> On Sun, June 1, 2008 10:30 am, Alan Gauld wrote:
>
>> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>>
>>
>>> Assuming the strings are non-overlapping, i.e. the closing "." of
>>> one string is not the opening "." of another, you
On Sun, June 1, 2008 10:30 am, Alan Gauld wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>
>
>> Assuming the strings are non-overlapping, i.e. the closing "." of
>> one string is not the opening "." of another, you can find them all with
>> import re re.findall(r'\..*?\.', text)
>
> Hmm, my reg
"Kent Johnson" <[EMAIL PROTECTED]> wrote
Assuming the strings are non-overlapping, i.e. the closing "." of
one
string is not the opening "." of another, you can find them all with
import re
re.findall(r'\..*?\.', text)
Hmm, my regex hopelessness comes to the fore again.
Why a *?
I would pr
Thank-you Kent - it works a treat!
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Sunday, June 01, 2008 4:25 AM
Subject: Re: [Tutor] finding special character string
On Sun, Jun 1, 2008 at 6:48 AM, Dinesh B Vadhia
<[EMAIL PROTECTED]>
Dinesh B Vadhia wrote:
A text document has special character strings defined as "." + "set of
characters" + ".". For example, ".sup." or ".quadbond." or ".degree."
etc. The length of the characters between the opening "." and closing
"." is variable.
Assuming that you don't know beforehand
On Sun, Jun 1, 2008 at 6:48 AM, Dinesh B Vadhia
<[EMAIL PROTECTED]> wrote:
> A text document has special character strings defined as "." + "set of
> characters" + ".". For example, ".sup." or ".quadbond." or ".degree." etc.
> The length of the characters between the opening "." and closing "." is
Dinesh B Vadhia wrote:
A text document has special character strings defined as "." + "set of
characters" + ".". For example, ".sup." or ".quadbond." or ".degree."
etc. The length of the characters between the opening "." and closing
"." is variable.
Assuming that you don't know beforehand
A text document has special character strings defined as "." + "set of
characters" + ".". For example, ".sup." or ".quadbond." or ".degree." etc.
The length of the characters between the opening "." and closing "." is
variable.
Assuming that you don't know beforehand all possible special char
14 matches
Mail list logo