tinyc4 / builder.py
exponent's picture
Update builder.py
079c4e2
raw
history blame
917 Bytes
import os
# Define the names of the input files
file1_name = "train_0.txt"
file2_name = "train_1.txt"
# Define the name of the output file
output_file_name = "train.txt"
# Open the first input file in read mode
with open(file1_name, 'r', errors='ignore') as file1:
file1_content = file1.read()
# Open the second input file in read mode
with open(file2_name, 'r', errors='ignore') as file2:
file2_content = file2.read()
# Open the output file in write mode and combine the contents
with open(output_file_name, 'w', errors='ignore') as output_file:
output_file.write(file1_content)
output_file.write("\n") # Add a newline between the contents of the two files
output_file.write(file2_content)
print(f"Contents of {file1_name} and {file2_name} have been combined into {output_file_name}")
os.remove(file1_name)
os.remove(file2_name)
print(f"{file1_name} and {file2_name} have been deleted.")