Python Error: TypeError: write() argument must be str, not bytes

Debashis
1 min readJan 30, 2017

--

The solution to this error when saving a downloaded page to file:

TypeError: write() argument must be str, not bytes

is:

outFile = open('output.xml', 'wb')
"b" for binary makes the difference.

--

--