On Thu, 16 Jul 2009 11:02:57 -0500, Pablo Torres N. wrote:
On Thu, Jul 9, 2009 at 22:07, Steven
D'Apranoste...@remove.this.cybersource.com.au wrote:
On Thu, 09 Jul 2009 18:36:05 -0700, inkhorn wrote:
def list_items_in_string(list_items, string):
for item in list_items:
if item
Hi all,
This was more a question of programming aesthetics for me than one of
great practical significance. I was looking to perform a certain
function on files in a directory so long as those files weren't found
in certain standard directories. In other words, I was using os.walk
() to get
Sure, Aho-Corasick is fast for fixed strings; but without real
numbers / a concrete goal
Matt, how many words are you looking for, in how long a string ?
a simple solution is good enough, satisficing. Matt asked how to
make that function look nicer?
but nice has many dimensions -- bicycles are
On Tue, 14 Jul 2009 02:06:04 -0300, Gabriel Genellina wrote:
Matt, how many words are you looking for, in how long a string ?
Were you able to time any( substr in long_string ) against re.compile
( |.join( list_items )) ?
There is a known algorithm to solve specifically this problem
Nobody wrote:
On Tue, 14 Jul 2009 02:06:04 -0300, Gabriel Genellina wrote:
Matt, how many words are you looking for, in how long a string ?
Were you able to time any( substr in long_string ) against re.compile
( |.join( list_items )) ?
There is a known algorithm to solve specifically this
En Mon, 13 Jul 2009 10:11:09 -0300, denis denis-bz...@t-online.de
escribió:
Matt, how many words are you looking for, in how long a string ?
Were you able to time any( substr in long_string ) against re.compile
( |.join( list_items )) ?
There is a known algorithm to solve specifically this
Thanks all!! I found the following to be most helpful: any(substr in
long_string for substr in list_of_strings)
This bang-for-your-buck is one of the many many reasons why I love
Python programming :)
Matt Dubins
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
For one of my projects, I came across the need to check if one of many
items from a list of strings could be found in a long string. I came
up with a pretty quick helper function to check this, but I just want
to find out if there's something a little more elegant than what I've
cooked
On Thu, Jul 9, 2009 at 6:36 PM, inkhornmatt.dub...@sympatico.ca wrote:
Hi all,
For one of my projects, I came across the need to check if one of many
items from a list of strings could be found in a long string. I came
up with a pretty quick helper function to check this, but I just want
to
On Thu, 09 Jul 2009 18:36:05 -0700, inkhorn wrote:
For one of my projects, I came across the need to check if one of many
items from a list of strings could be found in a long string.
If you need to match many strings or very long strings against the same
list of items, the following should
inkhorn matt.dub...@sympatico.ca writes:
def list_items_in_string(list_items, string):
for item in list_items:
if item in string:
return True
return False
You could write that as (untested):
def list_items_in_string(list_items, string):
return any(item in
On Thu, 09 Jul 2009 18:36:05 -0700, inkhorn wrote:
def list_items_in_string(list_items, string):
for item in list_items:
if item in string:
return True
return False
...
Any ideas how to make that function look nicer? :)
Change the names. Reverse the order of the
On Jul 10, 12:53 pm, Nobody nob...@nowhere.com wrote:
On Thu, 09 Jul 2009 18:36:05 -0700, inkhorn wrote:
For one of my projects, I came across the need to check if one of many
items from a list of strings could be found in a long string.
If you need to match many strings or very long
13 matches
Mail list logo