import requests wan="https://www.sogou.com/" def pac(wan): print("第",i+1,"次访问") r=requests.get(wan,timeout=30) r.raise_for_status() print("text编码方式为",r.encoding) print("网络状态码为:",r.status_code) print("text属性长度:",len(r.text)) print("content属性长度:",len(r.content)) return r.text for i in range(20): print(pac(wan))