hikyuu2/hikyuu/util/unicode.py

32 lines
858 B
C++
Raw Normal View History

2015-01-07 01:26:14 +08:00
#!/usr/bin/python
# -*- coding: utf8 -*-
# cp936
#===============================================================================
# 作者fasiondog
# 历史120130419, Added by fasiondog
#===============================================================================
#加入__unicode__和__repr__函数
import sys
if sys.version > '3':
IS_PY3 = True
else:
IS_PY3 = False
if IS_PY3:
unicodeFunc = str
def reprFunc(self):
return "<%s>"%str(self)
else:
if sys.platform == 'win32':
def unicodeFunc(self):
return str(self).decode('gb18030')
def reprFunc(self):
return "<%s>"%unicode(self).encode('gb18030')
else:
def unicodeFunc(self):
return str(self).decode('utf8')
def reprFunc(self):
return "<%s>"%unicode(self).encode('utf8')