定义一个函数,可以接受任意个数字符,过滤其中非数字字符,留下所有不重复的数字。
接受用户输入的多个字符,使用函数,打印输出其中不重复的数字。
望采纳, 谢谢!
#过滤其中非数字字符,留下所有不重复的数字。
def con(s):
str1 = ''
for i in s:
if i>='0' and i<='9':
if i not in str1:
str1+= i
return str1
data = input()
print(con(data))