import csv
import os
import sys

def addDatapoint(fifilepathle,datapoint):
    with open(filepath, 'a', newline='' ) as f:
        writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writerow(datapoint)
        f.close()

def addDatapoints(filepath,datapoints):
    with open(filepath, 'a', newline='' ) as f:
        writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writerows(datapoints)
        f.close()

def createNewCSV(name,fileLocation,header):
    filepath = fileLocation + '\\' + name + '.csv'

    with open(filepath, 'w', newline='' ) as f:
        writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writerow(header)
        f.close()

    return filepath

header = ['x','y']
fileName = 'test'


filepath = os.getcwd() + '\\' + fileName + '.csv'

#os.remove(filepath)

filepath = createNewCSV(fileName,os.getcwd(),header)
print(filepath)

addDatapoint(filepath,(10,10))
addDatapoints(filepath,((1, 2 ),(3, 4)))
