Fountain Coach Gitowner-controlled · read only

the-four-stars.git · README.md

the-four-stars.git / README.md

revision 0a805307ec72ac506b8b2fe6f50a535d483a6ed1 · complete file

# the-four-stars
```
import os

directory = '/Users/tadi/tada/the-four-stars'  # Replace with the path to your directory
output_file = 'merged.txt'       # Name of the output file

with open(output_file, 'w') as outfile:
    for filename in os.listdir(directory):
        if filename.endswith('.txt'):
            with open(os.path.join(directory, filename), 'r') as infile:
                outfile.write(infile.read())
                # Remove the line below to avoid adding an extra newline
                # outfile.write('\n')
```