Finding Peoples' Names in Files

cokofreedom at cokofreedom at
Thu Oct 11 17:49:03 CEST 2007

On Oct 11, 5:40 pm, brad <byte8b... at> wrote:
> cokofree... at wrote:
> > On Oct 11, 5:22 pm, brad <byte8b... at> wrote:
> >> Crazy question, but has anyone attempted this or seen Python code that
> >> does? For example, if a text file contained 'Guido' and or 'Robert' and
> >> or 'Susan', then we should return True, otherwise return False.
> > Can't you just use the string function .findall() ?
> I mean *any* possible person's name... I don't *know* the names
> beforehand :)

Well for something like that you could either do a search
for .istitle() through the file with a for loop, but that will catch
those after a full stop, or other random entries.

Otherwise, you get a HUGE list of all possible names? In dictionary
format for best option, and check the file against in using "in"... can you know it is a name...

More information about the Python-list mailing list