python判断是否为中文、中文符号、英文、英文符号

def is_Chinese(w):
    if '\u4e00' <= w <= '\u9fff':
        return True
def is_zh_punctuation(w):
    punctuation_str = punctuation   #中文符号
    if w in punctuation_str:
        return True
def is_en(w):
    if 'a'<=w<='z' or 'A'<=w<='Z':
        return True
def is_en_punctuation(w):
    punctuation_string = string.punctuation
    if w in string.punctuation:
        return True

你可能感兴趣的:(编程笔记,python,开发语言,后端)