1
コード:書き込みhtmlのstrをファイルにデコードし、HTMLのバイナリデータをファイルに直接書き込むのに違いはありますか?
from urllib import request
response = request.urlopen('http://www.amazon.com/')
body = response.read()
with open('test.html', 'wb') as f:
f.write(body)
with open('test2.html', 'w') as f:
f.write(body.decode('utf-8'))
任意の違いや何かに注意を払う必要がありますか?