Skip to article
← Wojciech Muła's Site
Open in Preserve Reader
Post · 1 min read· p. 80

Python: test if object is iterable

Wojciech Muła's Site · Wojciech Muła · 1 min
text
def isiterable(obj)
        try:
                iter(obj)
                return True
        except TypeError:
                return False
← Previous Traversing tree without stack Next → Efficient trie representation