コード例 #1
0
ファイル: unicode_utils.py プロジェクト: 17zuoye/etl_utils
        def func(str1, method, width, fillchar):
            if isinstance(str1, str):
                str1 = unicode(str1, "UTF-8")
            assert isinstance(str1, unicode)

            two_width_count = len([s1 for s1 in str1 if is_wide_char(s1, 0)])
            return getattr(str1, method)(width - two_width_count, fillchar)
コード例 #2
0
        def func(str1, method, width, fillchar):
            if isinstance(str1, str):
                str1 = unicode(str1, "UTF-8")
            assert isinstance(str1, unicode)

            two_width_count = len([s1 for s1 in str1 if is_wide_char(s1, 0)])
            return getattr(str1, method)(width - two_width_count, fillchar)
コード例 #3
0
ファイル: model.py プロジェクト: mvj3/textmulclassify
 def get_width(str1):
     c = 0
     for s1 in str1:
         c += (2 if is_wide_char(s1, 0) else 1)
     return c
コード例 #4
0
ファイル: model.py プロジェクト: 17zuoye/textmulclassify
 def get_width(str1):
     c = 0
     for s1 in str1:
         c += (2 if is_wide_char(s1, 0) else 1)
     return c