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 -- http://mail.python.org/mailman/listinfo/python-list