1. 程式人生 > >問題:(機器學習)TypeError: write() argument must be str, not bytes

問題:(機器學習)TypeError: write() argument must be str, not bytes

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

原因是開啟檔案的方式有問題,儲存方式預設為二進位制方式。

把其中的'w'改為'wb+'就好了

下一個問題出來了。。。

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

同樣的把'r'改為'rb+'就好了