[Solved] Separate a row of strings into separate rows [closed]


Python Power Unleased :

import csv,sys
filename="a.csv"
with open(filename,'rb') as csvfile:
reader = csv.reader(csvfile,delimiter=",")
try:
    for row in reader:
        if row[1].find(',') == -1:
            line=",".join(row)
            print line
        else:
            for i in range(0,row[1].count(',')+1):
                line = row[0]+','+row[1].split(',')[i]+','+row[2].split(',')[i]
                print line
except csv.Error as e:
    sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))

solved Separate a row of strings into separate rows [closed]