I would like to use a try except to see if a value exists.  But, when I use
the following, if a does not exist it exits.  I understand why this does
this, but is there a way to get b,c, and d if a does not exist without using
a try except for every statement?

try:
    fo.write("a = %s\n" %plan.a)
    fo.write("b = %s\n" %plan.b)
    fo.write("c = %s\n" %plan.c)
    fo.write("d = %s\n" %plan.d)
except AttributeError:
    pass

-- 
"Any intelligent fool can make things bigger, more complex, and more
violent. It takes a touch of genius - and a lot of courage - to move in the
opposite direction. "  -Albert Einstein
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to