Created
August 5, 2014 20:47
-
-
Save davidcorbin/84ebb032ebcce013327f to your computer and use it in GitHub Desktop.
Test if string
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
thisint = 1 | |
thisstring = "asdf" | |
if isinstance(thisstring, basestring) : | |
print thisstring + " is a string" | |
else: | |
print thisstring + " is an int" | |
if isinstance(thisint, basestring) : | |
print str(thisint) + " is a string" | |
else: | |
print str(thisint) + " is an int" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment