1. 程式人生 > >HTTP頭和網頁分離方法

HTTP頭和網頁分離方法

\n pen utf spa ade http pan split span

header, html = data.split(b‘\r\n\r\n‘, 1)
print(header.decode(‘utf-8‘))
# 把接收的數據寫入文件:
with open(‘sina.html‘, ‘wb‘) as f:
    f.write(html)

HTTP頭和網頁分離方法