hikyuu2/hikyuu/util/unicode.py

32 lines
858 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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')