This is a derivative from this question. In that one, the following line comes up in a pythonscript:
c1,c2 = [float(x) for x in line.split()] #convert line into 2 floats and unpack
when reading a data file with two columns.
Now, my real data file has 31 columns and I need to use columns 28 and 31 instead of 1 and 2. When I try the simplest (and ugliest) approach at escalating that line:
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31 = [float(x) for x in line.split()]
I get the error:
ValueError: too many values to unpack
How can I properly read all the columns in my file?