Skip to content

Instantly share code, notes, and snippets.

@dreikanter
Created July 8, 2013 16:58
Show Gist options
  • Save dreikanter/5950515 to your computer and use it in GitHub Desktop.
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
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