这?if "A" in myString: myString.replace("G", "")或这个?A = FalseG = Falsefor each in myString: if each == "A": if not A: temp += each A = True elif each == "G": if not G: temp += each G = True else: temp += eachmyString = temp