I have a data-file the first 8 lines of which look like this. (after substituting actual values by letters for clarity of this question)
a,b,c
d
e,f
g,h
i,j,k
l
m,n
o,p
These represent data about transformers in an electric network. The first 4 lines are information about transformer 1, the next four about transformer 2 and so on.
The variables a-p can are either integers, floating-point numbers or strings
I need to write a script in python so that that instead of data for one transformer being spread onto 4 lines, it should all be on one line.
More precisely, I would like the above 2 lines to be converted into
a,b,c,d,e,f,g,h
i,j,k,l,m,n,o,p
and write this to another data-file.
How do I do this?