checking for the existence of an attribute

Bob Roberts bobnotbob at byu.edu
Sun Oct 12 13:23:54 EDT 2003


I'm sure there must be a better way to do this:

        try:
            if item.page:
                DoSomething()
        except AttributError:
            pass

Is there a simple way to check if item has "page" as one of its attributes?




More information about the Python-list mailing list