Skip to content

Instantly share code, notes, and snippets.

@schbrongx
Last active April 10, 2017 11:53
Show Gist options
  • Save schbrongx/ad66fdd50d72b0042cd26c2689b0c10f to your computer and use it in GitHub Desktop.
Save schbrongx/ad66fdd50d72b0042cd26c2689b0c10f to your computer and use it in GitHub Desktop.
def is_iterable(_obj):
''' Returns True when _obj is iterable and not a string '''
import types
if not isinstance(_obj, types.StringTypes):
try:
iterable = iter(_obj)
except:
iterable = False
else:
iterable = False
return iterable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment