Skip to content

Instantly share code, notes, and snippets.

@Quiark
Created April 27, 2015 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quiark/7e7cf20e2749f52ef7ed to your computer and use it in GitHub Desktop.
Save Quiark/7e7cf20e2749f52ef7ed to your computer and use it in GitHub Desktop.
Loading the strokes.csv
def load_3d_csv(fname):
sta = []
with open(fname, 'rb') as inf:
rdr = csv.reader(inf, delimiter=';')
for ix, row in enumerate(rdr):
try:
if ix == 0: header = row
else: sta.append({header[y]: eval(row[y]) for y in range(len(row)) if row[y] != ''})
except SyntaxError as e:
logging.error('Problem reading {} at line {}'.format(fname, ix))
raise e
return sta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment