I have the following lisp file, which is from the UCI machine learning database. I would like to convert it into a flat text file using python. A typical line looks like th
Since the data is already in Lisp, use lisp itself:
(let ((input '(1 ((ST 8) (PITCH 67) (DUR 4) (KEYSIG 1) (TIMESIG 12) (FERMATA 0))
((ST 12) (PITCH 67) (DUR 8) (KEYSIG 1) (TIMESIG 12) (FERMATA 0)))))
(let ((row-headers (mapcar 'car (second input)))
(row-data (mapcar (lambda (row) (mapcar 'second row)) (cdr input))))
(format t "~{~A~^ ~}~%" row-headers)
(format t "~{~{~A~^ ~}~^ ~%~}" row-data)))