I have the following array:
array = ['[email protected]','[email protected]','[email protected]']
and then I have a text file with the following:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
How could I remove the elements in the text file from my array, that is, so that the file remains as follows:
[email protected]
[email protected]
[email protected]
A simple way would be to process your input file line by line and check for each line if that data is in your array, and if it is not , write it to another output file.
So:
What
linea.strip()
it does is to eliminate any spaces that may have in the file in front or behind, as well as the carriage return, before comparing it with the elements of the array.