程序员 php centos 开源 google 微软 wordpress HTML5 Windows Android nginx java mysql linux命令 Python apache Ubuntu shell linux Firefox

Python 读取中文网页

# coding=gbk
import http.client
import codecs

conn = http.client.HTTPConnection("www.baidu.com")
conn.request("GET","/index.html")
r1 = conn.getresponse()
print(r1.status, r1.reason)
print(r1.getheaders())
data1 = r1.read(102400)
print( data1.decode("gbk"))

延伸阅读

评论

暂无评论

写评论