Re: [Tutor] finding special character string

2008-06-03 Thread Marilyn Davis
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! > >

Re: [Tutor] finding special character string

2008-06-03 Thread Kent Johnson
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

Re: [Tutor] finding special character string

2008-06-03 Thread Dinesh B Vadhia
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

Re: [Tutor] finding special character string

2008-06-02 Thread Santiago PayĆ  i Miralta
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 "."

Re: [Tutor] finding special character string

2008-06-01 Thread Kent Johnson
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

Re: [Tutor] finding special character string

2008-06-01 Thread Marilyn Davis
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

Re: [Tutor] finding special character string

2008-06-01 Thread Kent Johnson
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

Re: [Tutor] finding special character string

2008-06-01 Thread Marilyn Davis
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

Re: [Tutor] finding special character string

2008-06-01 Thread Alan Gauld
"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

Re: [Tutor] finding special character string

2008-06-01 Thread Dinesh B Vadhia
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]>

Re: [Tutor] finding special character string

2008-06-01 Thread bob gailer
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

Re: [Tutor] finding special character string

2008-06-01 Thread Kent Johnson
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

Re: [Tutor] finding special character string

2008-06-01 Thread bob gailer
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

[Tutor] finding special character string

2008-06-01 Thread Dinesh B Vadhia
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