Remove a string from another string
python
Solution
a = '"ONE" # "TWO" # "THREE" # "FOUR" # "FIVE"'
b = '"NANA" # "PAA" # "THREE" # "ELI"'
a_elements = set(a.split(' # '))
b_elements = [key for key in b.split(' # ') if key not in a_elements]
b = ' # '.join(b_elements)
Problem
I have two string variables - `string_A` and `string_B`. `string_A` contains the following: `"ONE" # "TWO" # "THREE" # "FOUR" # "FIVE"` and `string_B` contains: `"NANA" # "PAA" # "THREE" # "ELI"` I want to remove all the elements that are in `string_A` from `string_B`. After I print `string_B` it should look like `"NANA" # "PAA" # "ELI"` Update: ``` x = textA.split(' # ') y = textB.split(' # ') for i, j in enumerate(x): if j in y[i]: pass ```