题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
def char_type_count(str): string = "".join(set(str)) # 去重之后连接成新的字符串 count = 0 for i in string: # 遍历string if 0 <= ord(i) <= 127: # ord(i)代表i的ascii码的值 count += 1 print(count) char_type_count(input()) # 直接调用这个函数