<s>[INST] I have a folder with subfolders, like this:

```
Main
+ Folder1
    + Subfolder1
        File1.txt
        File2.txt
    + Subfolder2
        File3.txt
+ Folder2
    + Subfolder3
        File4.txt
        File5.txt
```

I want to write a Python script that finds all .txt files in this folder and subfolders and writes a new .txt file with all the contents of the old files combined.

Here is my attempt, but I'm getting an error that says: `TypeError: write() argument must be str, not bytes`

```
import os
with open('output.txt', 'w') as output_file:
    for path, dirs, files in os.walk('Main'):
        for file in files:
            if file.endswith('.txt'):
                file_path = os.path.join(path, file)
                content = open(file_path, 'rb').read()
                output_file.write(content)
```

What am I doing wrong?[/INST]