python返回汉字的首字母
发布时间:2020-12-17 17:18:36 所属栏目:Python 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 def get_first_letter(char): char=char.encode('GBK') if charb"xb0xa1" or charb"xd7xf9": return "" if charb"xb0xc4": return "a" if charb
以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 def get_first_letter(char): char=char.encode('GBK') if char<b"xb0xa1" or char>b"xd7xf9": return "" if char<b"xb0xc4": return "a" if char<b"xb2xc0": return "b" if char<b"xb4xed": return "c" if char<b"xb6xe9": return "d" if char<b"xb7xa1": return "e" if char<b"xb8xc0": return "f" if char<b"xb9xfd": return "g" if char<b"xbbxf6": return "h" if char<b"xbfxa5": return "j" if char<b"xc0xab": return "k" if char<b"xc2xe7": return "l" if char<b"xc4xc2": return "m" if char<b"xc5xb5": return "n" if char<b"xc5xbd": return "o" if char<b"xc6xd9": return "p" if char<b"xc8xba": return "q" if char<b"xc8xf5": return "r" if char<b"xcbxf9": return "s" if char<b"xcdxd9": return "t" if char<b"xcexf3": return "w" if char<b"xd1x88": return "x" if char<b"xd4xd0": return "y" if char<b"xd7xf9": return "z" 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |