import csv
import re

file = open('LZMP3.csv', 'w+')
file.close()

with open('LZ.csv', 'r', encoding='utf-8') as input_file, open('LZMP3.csv', 'w', encoding='utf-8',
                                                               newline='') as output_file:
    reader = csv.reader(input_file, delimiter=';')  # Tab als Trennzeichen
    writer = csv.writer(output_file, delimiter=';')  # Semikolon als Trennzeichen

    for row in reader:
        print(row)
        row[0] = row[0].replace("!","").replace("?", "")
        row[1] = row[1].replace("!", "").replace("?", "")
        row[0] = re.sub(r" \.+", "", row[0])
        row[1] = re.sub(r" \.+", "", row[1])
        if len(row) >= 2:
            column3 = (row[1]+".mp3").replace(" ", "_")
            #column3 = re.sub(r" \.+", ".", column3)


            writer.writerow([row[0], row[1], column3])  # Spalte 2 und 3 schreiben
