Idea from V88 to remove empty items from csvreader's output.
Erik's code:
def txttoarr(fname, remove_last = False, offset = 4, *kwargs):
import numpy as np
with open (fname, 'r') as myfile:
data = myfile.read().replace(',', '.').replace('\n', ',').replace(' ', ',').replace("\t",",")
datarray = data.split(',')
output = []
for item in datarray:
if item != '':
output.append((item))
internal = []
for item in output[offset:]:
internal.append(float(item))
output =(internal)
x = output[0::2]
y = output[1::2]
return [x,y]
Idea from V88 to remove empty items from csvreader's output. Erik's code: