write() argument must be str, not bytes // a bytes-like object is required, not 'method

write() argument must be str, not bytes // a bytes-like object is required, not 'method

本人也在刚开始学习爬虫,出现了这个我问题,(write() argument must be str, not bytes),这里你自己看下在打开文件并写文件时,用的‘w’,还是’wb’,避免以上错误,需要在字符串前增加b将str转换为bytes,你就会发现自己的小问题了,
还有一种问题,a bytes-like object is required, not ‘method’,这种问题很神奇,你看下自己的read后面有没有括号,