Re: fixing an horrific formatted csv file.

2014-07-04 Thread Gregory Ewing
flebber wrote: so in my file I had on line 44 this trainer name. Michael, Wayne John Hawkes and in line 95 this horse name. Inz'n'out this throws of my capturing correct item 9. How do I protect against this? Use python's csv module to read the file. Don't try to do it yourself; the rules

Re: fixing an horrific formatted csv file.

2014-07-04 Thread flebber
On Friday, 4 July 2014 14:12:15 UTC+10, flebber wrote: I have taken the code and gone a little further, but I need to be able to protect myself against commas and single quotes in names. How is it the best to do this? so in my file I had on line 44 this trainer name.

Re: fixing an horrific formatted csv file.

2014-07-04 Thread flebber
On Friday, 4 July 2014 16:19:09 UTC+10, Gregory Ewing wrote: flebber wrote: so in my file I had on line 44 this trainer name. Michael, Wayne John Hawkes and in line 95 this horse name. Inz'n'out this throws of my capturing correct item 9. How do I protect against

Re: fixing an horrific formatted csv file.

2014-07-04 Thread F.R.
On 07/04/2014 12:28 PM, flebber wrote: On Friday, 4 July 2014 14:12:15 UTC+10, flebber wrote: I have taken the code and gone a little further, but I need to be able to protect myself against commas and single quotes in names. How is it the best to do this? so in my file I had on line 44

Re: fixing an horrific formatted csv file.

2014-07-03 Thread flebber
I have taken the code and gone a little further, but I need to be able to protect myself against commas and single quotes in names. How is it the best to do this? so in my file I had on line 44 this trainer name. Michael, Wayne John Hawkes and in line 95 this horse name. Inz'n'out this

Re: fixing an horrific formatted csv file.

2014-07-02 Thread flebber
TM = TX.Table_Maker (headings = ('Meeting','Date','Race','Number','Name','Trainer','Location')) TM (race_table (your_csv_text)).write () Where do I find TX? Found this mention in the list, was it available in pip by any name?

Re: fixing an horrific formatted csv file.

2014-07-02 Thread F.R.
On 07/02/2014 11:13 AM, flebber wrote: TM = TX.Table_Maker (headings = ('Meeting','Date','Race','Number','Name','Trainer','Location')) TM (race_table (your_csv_text)).write () Where do I find TX? Found this mention in the list, was it available in pip by any name?

fixing an horrific formatted csv file.

2014-07-01 Thread flebber
What I am trying to do is to reformat a csv file into something more usable. currently the file has no headers, multiple lines with varying columns that are not related. This is a sample Meeting,05/07/14,RHIL,Rosehill Gardens,Weights,TAB,+3m Entire Circuit, , Race,1,CIVIC

Re: fixing an horrific formatted csv file.

2014-07-01 Thread MRAB
On 2014-07-01 15:04, flebber wrote: What I am trying to do is to reformat a csv file into something more usable. currently the file has no headers, multiple lines with varying columns that are not related. This is a sample Meeting,05/07/14,RHIL,Rosehill Gardens,Weights,TAB,+3m Entire Circuit,

Re: fixing an horrific formatted csv file.

2014-07-01 Thread F.R.
On 07/01/2014 04:04 PM, flebber wrote: What I am trying to do is to reformat a csv file into something more usable. currently the file has no headers, multiple lines with varying columns that are not related. This is a sample Meeting,05/07/14,RHIL,Rosehill Gardens,Weights,TAB,+3m Entire

Re: fixing an horrific formatted csv file.

2014-07-01 Thread flebber
That's a really cool solution. I understand why providing full solutions is frowned upon, because it doesn't assist in learning. Which is true, it's incredibly helpful in this case. The python cookbook is really good and what I was using as a start for dealing with csv. But it doesn't even go

Re: fixing an horrific formatted csv file.

2014-07-01 Thread Chris Angelico
On Wed, Jul 2, 2014 at 7:41 AM, flebber flebber.c...@gmail.com wrote: I understand why providing full solutions is frowned upon, because it doesn't assist in learning. Which is true, it's incredibly helpful in this case. In this case, my main reason for not providing a full solution is that