HTTP头和网页分离方法

header, html = data.split(b'

', 1)
print(header.decode('utf-8'))
# 把接收的数据写入文件:
with open('sina.html', 'wb') as f:
    f.write(html)
原文地址:https://www.cnblogs.com/LewisAAA/p/9248077.html