Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:17:19 AM UTC-7, Tim Chase wrote: > [mercy, you could have trimmed down that reply] > > > > On 2013-09-28 10:43, cerr wrote: > > > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > > >> import re > > > > > > Great, only I don't have the re

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:07:11 AM UTC-7, MRAB wrote: > On 28/09/2013 18:43, cerr wrote: > > [snip] > > > Great, only I don't have the re module on my system :( > > > > > Really? It's part of Python's standard distribution. Oh no, sorry, mis-nformation, i DO have module re availab

Re: replace only full words

2013-09-28 Thread Tim Chase
[mercy, you could have trimmed down that reply] On 2013-09-28 10:43, cerr wrote: > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: >> import re > > Great, only I don't have the re module on my system :( Um, it's a standard Python library. You sure about that? http://docs

Re: replace only full words

2013-09-28 Thread MRAB
On 28/09/2013 18:43, cerr wrote: [snip] Great, only I don't have the re module on my system :( Really? It's part of Python's standard distribution. -- https://mail.python.org/mailman/listinfo/python-list

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > On 2013-09-28 09:11, cerr wrote: > > > I have a list of sentences and a list of words. Every full word > > > that appears within sentence shall be extended by i.e. "I > > > drink in the house." Would become "I in the ." (and >

Re: replace only full words

2013-09-28 Thread Jussi Piitulainen
MRAB writes: > On 28/09/2013 17:11, cerr wrote: > > Hi, > > > > I have a list of sentences and a list of words. Every full word > > that appears within sentence shall be extended by i.e. "I > > drink in the house." Would become "I in the ." (and > > not "I in the .")I have attempted it like thi

Re: replace only full words

2013-09-28 Thread MRAB
On 28/09/2013 17:11, cerr wrote: Hi, I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I drink in the house." Would become "I in the ." (and not "I in the .")I have attempted it like this: for sentence in sentences:

Re: replace only full words

2013-09-28 Thread Tim Chase
On 2013-09-28 09:11, cerr wrote: > I have a list of sentences and a list of words. Every full word > that appears within sentence shall be extended by i.e. "I > drink in the house." Would become "I in the ." (and > not "I in the .") This is a good place to reach for regular expressions. It com

replace only full words

2013-09-28 Thread cerr
Hi, I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I drink in the house." Would become "I in the ." (and not "I in the .")I have attempted it like this: for sentence in sentences: for noun in nouns: if " "+n