| | import os |
| |
|
| | |
| | file1_name = "train_0.txt" |
| | file2_name = "train_1.txt" |
| |
|
| | |
| | output_file_name = "train.txt" |
| |
|
| | |
| | with open(file1_name, 'r') as file1: |
| | file1_content = file1.read() |
| |
|
| | |
| | with open(file2_name, 'r') as file2: |
| | file2_content = file2.read() |
| |
|
| | |
| | with open(output_file_name, 'w') as output_file: |
| | output_file.write(file1_content) |
| | output_file.write("\n") |
| | 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.") |