Loop Iteration

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Dec 21 22:37:36 CET 2005

On Wed, 21 Dec 2005 18:05:22 +0000, RaH wrote:

> Hello.
> I am writing a script to parse my logfiles to monitor sshd attempted
> logins. I know I'm reinventing the wheel, but it's something I want
> to do. The problem I am having is that upon the 4th or 5th pass in my
> for statement I recieve an error
> AttributeError: 'NoneType' object has no
> attribute 'group'

At an interactive prompt, type help(re.match) and you will get:

match(pattern, string, flags=0)
    Try to apply the pattern at the start of the string, returning
    a match object, or None if no match was found.

When there is no match, your loop tries to call None.group. None has no
group attribute, just like the error message says.


More information about the Python-list mailing list