Having a string like this one:
machine1 volumename1 space1
machine1 volumename2 space2
machine2 volumename1 space1
machine2 volumename2 space2
machine3 volumename1 space1
I would like to remove all the lines containing one element of a list, for example:
list = ["machine1", "machine3"]
Receiving at the end something like this:
machine2 volumename1 space1
machine2 volumename2 space2
I tried with this, but it returns a list, and I would like to not change the original format of the string and I would like to use a list of machines as an input:
output = str([line for line in output.split('\n') if 'machine1' not in line and 'machine3' not in line])