python返回汉字的首字母
程序员文章站
2022-05-14 22:37:36
...
def get_first_letter(char):
char=char.encode('GBK')
if charb"\xd7\xf9":
return ""
if char
return "a"
if char
return "b"
if char
return "c"
if char
return "d"
if char
return "e"
if char
return "f"
if char
return "g"
if char
return "h"
if char
return "j"
if char
return "k"
if char
return "l"
if char
return "m"
if char
return "n"
if char
return "o"
if char
return "p"
if char
return "q"
if char
return "r"
if char
return "s"
if char
return "t"
if char
return "w"
if char
return "x"
if char
return "y"
if char
return "z"