import sys x = input() y = x[0] for i in range(1, len(x)): if x[i] not in y and ord(x[i]) >= 0 and ord(x[i]) <= 127: y = y + x[i] else: pass print(len(y))
【目的】
python中用于将字符转换为ASCII的方法为:ord();
python中用于将ASCII转换为字符的方法为:char()。