In <[EMAIL PROTECTED]>, Steven
D'Aprano wrote:

> for obj in Array:
>     if isinstance(obj, list):
>         for item in obj:
>             print item
>     else:
>         print obj

I would "reverse" that check and test `obj` for not being a string::

 for obj in Array:
     if not isinstance(obj, basestring):
         for item in obj:
             print item
     else:
         print obj

This way it works with other types of iterables than lists too.  Often
strings are the only type that one don't want to iterate over in such a
context.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to