You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
315 B
23 lines
315 B
6 years ago
|
|
||
|
import sys
|
||
|
|
||
|
# Syntax sugar.
|
||
|
_ver = sys.version_info
|
||
|
|
||
|
#: Python 2.x?
|
||
|
is_py2 = (_ver[0] == 2)
|
||
|
|
||
|
#: Python 3.x?
|
||
|
is_py3 = (_ver[0] == 3)
|
||
|
|
||
|
from io import open as io_open
|
||
|
|
||
|
if is_py2:
|
||
|
basestring = basestring
|
||
|
str = unicode
|
||
|
open = io_open
|
||
|
elif is_py3:
|
||
|
basestring = (str, bytes)
|
||
|
str = str
|
||
|
open = open
|