オブジェクトが走査可能かどうか調べる
if hasattr(obj, '__iter__'): for e in obj: pass
In Python, how do I determine if an object is iterable? - Stack Overflow
if hasattr(obj, '__iter__'): for e in obj: pass
In Python, how do I determine if an object is iterable? - Stack Overflow