Finding Peoples' Names in Files

Tim Williams tdwdotnet at
Thu Oct 11 17:34:01 CEST 2007

On 11/10/2007, brad <byte8bits 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.
> --

Text = open(fname).read()

def a_function():
    for Name in ['Guido', Robert',Susan']:
       if Name in Text:
           return 1

if a_function():
    print "A name was found"


More information about the Python-list mailing list