parser.add_argument('--csv','--csvfile','--in','--input',action='store',type=str,dest='csvfile',help='The name of the FR24 CSV file',required=True)
returnparser.parse_args()
defreverseCSV(csvfile):
"""Reverse a CSV. Returns a dictionary of the CSV"""
data=[]
withopen(csvfile,newline='')ascsvfilein:
reader=csv.DictReader(csvfilein,delimiter=',')
forrowinreader:
data.append(row)
csvfilein.close()
returnreversed(data)
defmain():
globalcfg
cfg=configparser.ConfigParser()
@ -27,19 +37,19 @@ def main():
csvFilename='fr24.csv'
time=0
#Need to reverse the FR24 CSV as it is in reverse order i.e. the most recent record is row 2 and the first ADS-B message of the flight is the last row in the CSV