On Wed, Oct 29, 2008 at 11:28 AM, bob gailer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> >> hello, >> i have the follwoing csv file: >> >> "Berat","Berat","Kuçovë","Skrapar"
> There is a csv module, but for something this simple the following will > suffice: as long as none of the data fields include a comma...given that the equivalent program using csv is barely longer than your example, and more robust, it seems worth using to me. For example (untested): import csv inputFile= open(path-to-the-input-file, 'rb') reader = csv.reader(inputFile) outputFile = open(path-to-the-output-file, 'wb') writer = csv.writer(outputFile) for line in reader: region = line [0] for district in line[1:]: writer.write((region, district)) inputFile.close() outputFile.close() Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor