On 7 Ago, 17:47, "Jerry Hill" <[EMAIL PROTECTED]> wrote:
> On 8/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > I have to parse a file (that is a dbIII file) whose stucture look like
> > this:
> > |string|, |string|, |string that may contain commas inside|, 1, 2, 3, |
> > other string|
>
> The CSV module is probably the easiest way to go:
>
> >>> data = "|string|, |string|, |string that may contain commas
>
> inside|, 1, 2, 3, |other string|">>> import csv
> >>> reader = csv.reader([data], quotechar="|", skipinitialspace=True)
> >>> for row in reader:
>
>         print row
>
> ['string', 'string', 'string that may contain commas inside', '1',
> '2', '3', 'other string']
>
> --
> Jerry


you all were right, I had to mention that I must put the datas in
mysql... So actually the best way to do it is with csv.reader: i tried
it and it works out!

thanx very much!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to