split_st_1 = ["Sentence1", "Sentence2", "Sentence3"] # list of lines of one text
split_tt_1 = ["Oración1", "Oración2", "Oración3"] # list of lines of the other text
with open("translation_memory.csv", "w", encoding = "utf-8") as f: # open file to overwrite
f.write("EN\tES\n") # write heading
for x, y in zip(split_st_1, split_tt_1): # go through each pair of lines
f.write(f"{x}\t{y}\n") # write the line
When you open it later with pandas, remember to specify that the separator is '\t'!
This is the code we saw earlier:
When you open it later with
pandas
, remember to specify that the separator is '\t'!