Reading a csv in python is just taking in a dictionary containing the lines consider the following:
import csv
with open('mycsv.csv', mode='r') as file:
mycsv = csv.DictReader(file)
you can then look at specific elements within the dicts, script ones you dont like. based on your example if you're trying to get rid of a line like these file is crypted with "asdfgghklm" you can just check to see if there's a second element and if not dump it, or you can ignore it when you're looping
If your file structure is exactly as you mentioned above the dictionary should come out looking like this
OrderedDict([('these file is crypted with "asdfg"', 'Name'), (None, ['Status', 'Time'])])
OrderedDict([('these file is crypted with "asdfg"', 'abc'), (None, ['failed', '7:30'])])
OrderedDict([('these file is crypted with "asdfg"', 'these file is crypted with "asdfgghklm"')])
OrderedDict([('these file is crypted with "asdfg"', 'Name'), (None, ['Status', 'Time'])])
OrderedDict([('these file is crypted with "asdfg"', 'def'), (None, ['running', '12:30'])])
This is based on the code:
import csv
with open('file.csv', mode='r') as file:
mycsv = csv.DictReader(file)
for line in mycsv :
print(line)
from here we can look at the output and use an if statement it terminate what you don't want and print what you do want. You will need to make adjustments based on your actual output, I like to use the print command first to guarantee i know how the system will see my csv file and then adapt my code to filter based on that formatting.