data = input("请输入字符串") newStr = "" for c in data: if c not in newStr: newStr += c print("去重后的结果为: {}".format(newStr))
结果:
如果觉得答案对你有帮助,请点击下采纳,谢谢~