Establishing if an Object is Defined

bg_ie at yahoo.com bg_ie at yahoo.com
Wed Jan 10 04:16:57 EST 2007


Hi,

The following code works -

one = 1
if one == 1:
  ok = 1
print ok

but this does not, without exception -

one = 2
if one == 1:
  ok = 1
print ok

How do I establish before printing ok if it actually exists so as to
avoid this exception?

Thanks for your help,

Barry.




More information about the Python-list mailing list