TypeError: write() argument must be str, not bytes code example
Example 1: python write request must be str not bytes
datafile = open(localfile, "w", encoding="utf-8")
datafile.write(page.text)
datafile.close()
Example 2: python elementTree tostring write() argument must be str, not bytes
>>> type(tostring(element, encoding="unicode"))
<class 'str'>