Filtering Characters from a String [duplicate]
问题 This question already has answers here : Remove specific characters from a string in Python (27 answers) Closed 6 years ago . I need to make a function that takes two strings as imnput and returns a copy of str 1 with all characters from str2 removed. First thing is to iterate over str1 with a for loop, then compare to str2, to accomplish subtraction I should create a 3rd string in which to store the output but I'm a little lost after that. def filter_string(str1, str2): str3 = str1 for