Markus Rosenstihl wrote: > Thank you for the fast reply > > Am 13.10.2005 um 19:43 schrieb Kent Johnson: > > > >> if len(filter(re_name.search, line)) > 0: >>could be written >> if re_name.search(line): > > > this is not working because I am parsing a line in a list (i think):
Ah, sorry, I misunderstood - line is a list of strings, not a single string. Can the name really appear in any field? Or could you use if re_name.search(line[4]) # (or whatever the correct field number) >>or even, since the re is just fixed text, >> if phone[name] in line: This should be if phone[name] in line[4] >>>Is there for example a way to search the whole list and give back all >>>the line numbers containing a string? >> >> [ i for i, line in enumerate(rechnung) if "Monatliche" in line ] Try [ i for i, line in enumerate(rechnung) if "Monatliche" in line[0] ] Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor