Berker Peksag added the comment:
This is already documented in the json.dump() documentation:
The json module always produces str objects, not bytes objects.
Therefore, fp.write() must support str input.
Note that the traceback you've posted doesn't have anything to do with the json
m
New submission from TaoQingyun <845767...@qq.com>:
```
>>> import json
>>> f = open('/tmp/t.json', 'wb')
>>> json.dump(123, f)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/json/__init__.py", line 180, in dump