Re: [Tutor] CSV Read

2018-06-30 Thread David Rock
> On Jun 30, 2018, at 02:01, Peter Otten <__pete...@web.de> wrote: > > > Rather than forcing both blocks into the same data structure I would read > the header with the "key: value" lines into a separate object. > > If the header and the X,Y pairs are separated by an empty line read until >

Re: [Tutor] CSV Read

2018-06-30 Thread Peter Otten
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 >

Re: [Tutor] CSV Read

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 13:18, Sergio Rojas wrote: > # read the whole file > with open(thefilename, 'r') as theFile: contentfile = theFile.read() > > # split the file in lines according to the newline character "\n" > templines = [] > for line in contentfile.splitlines(): >

Re: [Tutor] CSV Read

2018-06-29 Thread Sergio Rojas
On 25/06/18 20:35, 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

Re: [Tutor] CSV Read

2018-06-25 Thread Mats Wichmann
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:

Re: [Tutor] CSV Read

2018-06-25 Thread Alan Gauld via Tutor
On 25/06/18 20:35, 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

[Tutor] CSV Read

2018-06-25 Thread Giulia Marcoux
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