b = b'\x00'

with open('out.bin', 'wb') as f:
 print(b, file=f)

TypeError: a bytes-like object is required, not 'str'
なんで駄目なんだろう