def center_num(self, string):
        """
        返回总字符数(考虑英文和中文在终端所占字块)

        return: int
        """
        l = 0
        for i in string:
            l += 2 if self.is_cn_char(i) else 1
        return l
def center_num ( self , string ) : l = 0 for i in string : l += 2 if self . is_cn_char ( i ) else 1 return l
返回总字符数(考虑英文和中文在终端所占字块)

        return: int