hecko
07/21/2022, 5:44 PMpy
with open(os.path.join(folder, "transcription.txt")) as f:
lines = [i.split("|") for i in f.read().splitlines()]
# code goes here
with open(os.path.join(folder, "transcription.txt"), "w") as f:
f.write("\n".join(["|".join(i) for i in lines]))hecko
07/21/2022, 5:46 PMimport os
and then the code could be one line because list comprehensions
py
lines = [i for i in lines if os.path.exists(os.path.join(folder, i[0]))]{K EY1} (Kei)
07/21/2022, 5:46 PMhecko
07/21/2022, 5:46 PMhecko
07/21/2022, 5:46 PMhecko
07/21/2022, 5:46 PM{K EY1} (Kei)
07/21/2022, 5:46 PMhecko
07/21/2022, 5:47 PMhecko
07/21/2022, 5:47 PMhecko
07/21/2022, 5:48 PMhecko
07/21/2022, 5:51 PMlines2 = []
for i in lines:
if os.stat(os.path.join(folder, i[0])).st_size > (10 * 22050 * 2) + 44:
os.remove(os.path.join(folder, i[0]))
else:
lines2.append(i)
lines = lines2{K EY1} (Kei)
07/21/2022, 6:01 PMhecko
07/21/2022, 10:37 PMhecko
07/21/2022, 10:37 PMr right before the opening quote to stop python from treating the backslashes as special dinglets{K EY1} (Kei)
07/21/2022, 10:44 PM{K EY1} (Kei)
07/21/2022, 11:01 PMimport os
folder = "wavs"
with open(os.path.join("transcription.txt"), "r", encoding="UTF-8") as f:
lines = [i.split("|") for i in f.read().splitlines()]
lines = [i for i in lines if os.path.exists(os.path.join(folder, i[0]))]
with open(os.path.join("transcription.txt"), "w") as f:
f.write("\n".join(["|".join(i) for i in lines]))hecko
07/21/2022, 11:01 PMhecko
07/21/2022, 11:02 PM{K EY1} (Kei)
07/21/2022, 11:04 PMimport os
folder = "aus_allen_winkeln"
with open(os.path.join(folder, "transcription.txt"), "r", encoding="UTF-8") as f:
lines = [i.split("|") for i in f.read().splitlines()]
lines = [i for i in lines if os.path.exists(os.path.join(folder, i[0]))]
with open(os.path.join(folder, "transcription.txt"), "w", encoding="UTF-8") as f:
f.write("\n".join(["|".join(i) for i in lines])){K EY1} (Kei)
07/21/2022, 11:06 PMhecko
07/21/2022, 11:10 PMhecko
07/21/2022, 11:10 PMhecko
07/21/2022, 11:10 PMhecko
07/21/2022, 11:10 PM{K EY1} (Kei)
07/22/2022, 12:09 AMTheRoyalRuby2000
07/22/2022, 1:33 AMTheRoyalRuby2000
07/22/2022, 1:34 AMTheRoyalRuby2000
07/22/2022, 1:34 AMCouch
07/22/2022, 1:34 AMJack Frost
07/22/2022, 11:51 PM