Why Microsoft and Windows ?
B/c it was actually in the data I was trying to parse (though not
something I was needing to parse), I obscured everything except my test
search terms *shrugs*
I saw something on this group about 'to many "or's"' so I figured it
was an option. Thanks for the .splitline
Hi,
Le mardi 1 Mars 2005 22:15, [EMAIL PROTECTED] a écrit :
> Now I don't know this stuff very well but I dont think the code
>
> > [line for line in document if (line.find('word') != -1 \
> > and line.find('wordtwo') != -1)]
>
> would do this as it answers the question in how you thought
Hi,
This might even be faster since using re.search, we don't need to parse the
whole line.
Regards,
Francis Girard
=== BEGIN SNAP
## rewords.py
import re
import sys
def iWordsMatch(lines, word, word2):
reWordOneTwo = re.compile(r"((%s.*%s)|(%s.*%s))" %
(word,
I'm still very new to python (my 2nd day atm) but this is what I come
up with.
First note, I wasn't clear (I reread what I wrote) about my 'word'
'wordtwo' problem. Both words do Not need to be on the same line. But
rather say there was
Line 4: This is a line
Line 5: Yet another one
Line 6: its a
Le mardi 1 Mars 2005 21:38, Marc Huffnagle a écrit :
> My understanding of the second question was that he wanted to find lines
> which contained both words but, looking at it again, it could go either
> way. If he wants to find lines that contain both of the words, in any
> order, then I don't th
Francis Girard wrote:
Le mardi 1 Mars 2005 16:52, Marc Huffnagle a écrit :
[line for line in document if (line.find('word') != -1 \
and line.find('wordtwo') != -1)]
Hi,
Using re might be faster than scanning the same line twice :
My understanding of the second question was that he wanted to
Le mardi 1 Mars 2005 16:52, Marc Huffnagle a écrit :
> [line for line in document if (line.find('word') != -1 \
> and line.find('wordtwo') != -1)]
Hi,
Using re might be faster than scanning the same line twice :
=== begin snap
## rewords.py
import re
import sys
def iWordsMatch(lines, w
Oops, made a mistake.
Marc Huffnagle wrote:
Dasacc
There is a better (faster/easier) way to do it than using the re module,
the find method of the string class.
[EMAIL PROTECTED] wrote:
(1) How do I perform a search for "word" and have it return every line
that this instance is found?
[line for
Dasacc
There is a better (faster/easier) way to do it than using the re module,
the find method of the string class.
[EMAIL PROTECTED] wrote:
(1) How do I perform a search for "word" and have it return every line
that this instance is found?
[line for line in document if line.find('a') != -1]
(2)