How to Delete Rows CSV in python
问题 I'm trying to compare two csv files (fileA and fileB), and remove any rows from fileA that are not found in fileB. I want to be able to do this without creating a third file. I thought I could do this using the csv writer module but now I'm second guessing myself. Currently, I'm using the following code to record my comparison data from file B: removal_list = set() with open('fileB', 'rb') as file_b: reader1 = csv.reader(file_b) next(reader1) for row in reader1: removal_list.add((row[0], row