python2的兼容性
python3
from io import StringIO
python2
from io import BytesIO as StringIO
python3
class BaseClass:
def init(self):
...
class DeriveClass:
def init(self):
super().init()
python2
class BaseClass(object):
def init(self):
...
class DeriveClass:
def init(self):
super(DeriveClass, self).init()
import sys
def is_python_3():
return sys.version_info.major >= 3