data/method/python/test.txt

10 lines
488 B
Plaintext

import requests #导入爬虫的库,不然调用不了爬虫的函数
response = requests.get("http://www.1xuni.cn") #生成一个response对象
response.encoding = response.apparent_encoding #设置编码格式
print("状态码:"+ str( response.status_code ) ) #打印状态码
print(response.text)#输出爬取的信息