Say I have a CSV file.
It contains:
a,b,c
1,2,3
4,5,6
7,8,9
How can I turn the column labeled 'a' into a list, without hard-coding a row to it?
Originally, I was doing a readline for the first line a,b,c
and then hard-coding a row to each variable. But then I thought: what if I wanted to do it with the possibility of the CSV file not being arranged the same way - say:
b,a,c
2,1,3
5,4,6
8,7,9
What's the best way to go about this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…