data = {}
reader = csv.DictReader(open('infile', 'r'), fieldnames=['key', 'value'],
    delimiter='\t')
for row in reader:
    if row['key'] in data:
        data[row['key']].append(row['value'])
else:
    data[row['key']] = [row['value']]
writer = open('outfile', 'w')
for key in data:
    writer.write(key + '\t' + ';'.join(data[key]) + '\n')
writer.close()
merge multiple lines into single line by value of column