Created
July 8, 2013 16:58
-
-
Save dreikanter/5950515 to your computer and use it in GitHub Desktop.
Little trick to support both Python 2 an 3 dealing with string and char types
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
PY2 = sys.version_info[0] == 2 | |
if not PY2: | |
strtype = str | |
chrtype = chr | |
else: | |
strtype = unicode | |
chrtype = unichr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment