[Tutor] CSV Read

Mats Wichmann mats at wichmann.us
Mon Jun 25 19:30:22 EDT 2018


On 06/25/2018 01:35 PM, Giulia Marcoux wrote:
> Hello,
> 
> I am a student learning python, and i am running into some difficulties. I
> am tryign to read a csv file that has different delimiters for different
> rows: Example:
> 
> Format:V1.1
> Model: R
> Step Size: 10mm
> Distance: 10cm
> Gain: 1000
> 
> X,Y
> 1,3
> 2,5
> 6,5
> 5,7
> 
> For the X,Y data, I have no problem getting it into the right cells,
> however I cannot separate the values after the colon for the first few
> rows. Its either one or the other.

So you don't have a "csv file". You have a file with csv data, but also
with headers.  As Alan says, you want to divide it up so you've consumed
the non-csv data and have only the csv data left (notice X,Y isn't part
of your dataset either, even though it's in the format - it is column
headers). Then it should be easy to process.



More information about the Tutor mailing list