第一種是用urllib模塊,下面是例示代碼:
復(fù)制代碼代碼如下:
import request.urllib
status=request.urllib.urlopen("http://www.jb51.net").get_code
print status
第二章是用requests模塊,下面是例示代碼:
復(fù)制代碼代碼如下:
import requests
code=requests.get("http://www.jb51.net").status_code
print(code)