Commit 45060751 authored by Nic Arnold's avatar Nic Arnold
Browse files

added python script to convert flight gps data to clean csv

parent 46590e1f
#drone csv converter
import sys
def convert(inputfile):
#read input file
newname = inputfile[:-3]+"csv"
in_file = open(inputfile, 'r')
read_data = in_file.readlines()
in_file.close()
count=0
outfile = open(newname, 'w')
for line in read_data:
split_lines = line.split(',')
last3 = split_lines[-3:]
last3[-1] = last3[-1].strip()
count += 1
for element in last3:
if element == last3[-1]:
outfile.write(element)
outfile.write('\n')
else:
outfile.write(element)
outfile.write(',')
#print(count)
outfile.close()
convert(sys.argv[1])
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment