How to delete line from the file in python - Stack Overflow
https://stackoverflow.com/questions/737213909.09.2011 · Show activity on this post. It's not clear to me what the form of the file you are trying to modify is. I'm going to assume it looks like this: 1,2,3 4,5,7,19 6,2,57 7,8,9 128. Something like this might work for you: filter = set ( [2, 9]) lines = open ("data.txt").readlines () outlines = [] for line in lines: line_numbers = set (int (num) for ...
How to delete line from the file in python - Stack Overflow
stackoverflow.com › questions › 7372139Sep 10, 2011 · Show activity on this post. It's not clear to me what the form of the file you are trying to modify is. I'm going to assume it looks like this: 1,2,3 4,5,7,19 6,2,57 7,8,9 128. Something like this might work for you: filter = set ( [2, 9]) lines = open ("data.txt").readlines () outlines = [] for line in lines: line_numbers = set (int (num) for ...