没考虑到的:没考虑中间的点,因为点也不是汉字、字母、数字
def isaChinese(word): """judge first str if is a chinese :param word: first str :return: true or false """ if '\u4e00' <= word <= '\u9fff': return True return False def isplatenum(str): """judge if plate num :param str: detect result of plate frame :return: true or false """ newstr = str.rstrip() if isaChinese(newstr[0]): flag = newstr[1:].isalnum() # 字母和数字的组合 print("yes") else: flag = newstr.isalnum() print("yes") return flag