I'm new to Python, and don't know how to code this nicely (or even to search for the answer).
I'm reading data from a fixed-width file:
for line in file:
dataline = [ line[c[0]:c[1]] for c in columns ]
which gives me an array of strings:
>>> dataline
[' ', ' 2.447756', '0.674290', '313.2406', ' 35.7290', ' 17.8714', 'PAHFTEN ']
For each line in the file, I would like to shift each element of dataline
into a different array, e.g.,
dataline[0] ---> arrayA[0]
dataline[1] ---> arrayB[0]
dataline[2] ---> arrayC[0]
and so on. How can I do that nicely? Intuitively, I would like to do:
[arrayA[0], arrayB[0], arrayC[0], ...] = dataline