1import csv
2
3with open("infile.dat") as infile, open("outfile.csv", "w") as outfile:
4 csv_writer = csv.writer(outfile)
5 prev = ''
6 csv_writer.writerow(['ID', 'PARENT_ID'])
7 for line in infile.read().splitlines():
8 csv_writer.writerow([line, prev])
9 prev = line
10
1import csv
2
3with open("04122020_MCDXUV500REFBS4_01.dat") as infile, open("outfile.csv", "w") as outfile:
4 csv_writer = csv.writer(outfile)
5 prev = ''
6 csv_writer.writerow(['ID', 'PARENT_ID'])
7 for line in infile.read().splitlines():
8 csv_writer.writerow([line, prev])
9 prev = line
1import csv
2
3with open("s0164-head-up-tilt.dat") as infile, open("outfile.csv", "w") as outfile:
4 csv_writer = csv.writer(outfile)
5 prev = ''
6 csv_writer.writerow(['ID', 'PARENT_ID'])
7 for line in infile.read().splitlines():
8 csv_writer.writerow([line, prev])
9 prev = line