Last active
April 10, 2017 11:53
-
-
Save schbrongx/ad66fdd50d72b0042cd26c2689b0c10f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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