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 I asked.
Just use "or" instead of "and" and you'll get what you need. > var1 = "this is a test\nand another test" > [line for line in var1 if line.find('t') != -1] You are scanning the letters in the string. You first need to split your input into lines, in order to scan over strings in a list of strings. Use : var1 = "this is a test\nand another test" [line for line in var1.splitlines() if line.find('t') != -1] > for line in iWordsMatch(data, "microsoft", "windows") Same as above. Use: for line in iWordsMatch(data.splitlines(), "microsoft", "windows") Why Microsoft and Windows ? I am very pleased to see that Microsoft Windows is now used instead of foo bar. Regards -- http://mail.python.org/mailman/listinfo/python-list