Created
January 16, 2017 15:51
-
-
Save victorono/d3b9c689d466689e581f78489ad3fdf1 to your computer and use it in GitHub Desktop.
python 3 unicode migration
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
try: | |
unicode = unicode | |
except NameError: | |
# 'unicode' is undefined, must be Python 3 | |
str = str | |
unicode = str | |
bytes = bytes | |
basestring = (str, bytes) | |
else: | |
# 'unicode' exists, must be Python 2 | |
str = str | |
unicode = unicode | |
bytes = str | |
basestring = basestring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment