python 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 write request must be str not bytes
datafile = open(localfile, "wb")
datafile.write(page.content)
datafile.close()