I'm currently trying to make a program that makes a text file with the first line being 's16' after that it should fill the next lines with numbers. My current code looks something like this:

```
import os
import numpy as np
file = open('workfile.txt','wb')
file.write('s16\n')
array=np.eye(4)
np.savetxt(file, array, fmt='%.3f', newline=os.linesep)  

```

But this spits out an error at `file.write('s16\n')`, because I opened the file with 'wb' which means I'm trying to write bytes and 's16\n' is a string. But if I change 'wb' to just 'w' then `np.savetxt(file, wut, fmt='%.3f', newline=os.linesep)` throws a similar error for not being in 'wb' mode. Is there any way to reconcile these two? Thanks!