I have a big (75MB) datafile (EMP.txt) which looks like
01ABCD FIT PROGRAMMER30000EFGH
02IJK LMMACCOUNTS MANAGER 50000OPQRST UV
and so on. I have a structure file (EMPSTRU.txt) of the datafile which looks like
001 EMPID LENGTH 2
002 EMPNAME LENGTH 10
003 SEX LENGTH 1
004 DEPARTMENT LENGTH 10
005 DESIGNATION LENGTH 10
006 SALARY LENGTH 5
007 SUPERNAME LENGTH 10
Now how do I parse the datafile to csv format? I am using slice method to extract from the datafile. Also there are at least 150 field names. Is there a better way in python to get the column names? Currently I am manually typing them like
EMPID = Dataline(0:2)
Please help. Thanks.