标签:网址 pre imp x64 encoding image com win64 sts
import requests headers = {‘user-agent‘:‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36‘} url = "https://www.bilibili.com/" try: r = requests.get(url, headers=headers) #发送网络请求 print(r.status_code) r.encoding = r.apparent_encoding print(r.text[:2000]) except: print("爬取失败")
爬取的是B站的源码信息(因为代码量及显示问题我只要求输出2000字符),结果如下
右击爬取的网址得到的网页源代码如下
标签:网址 pre imp x64 encoding image com win64 sts
原文地址:https://www.cnblogs.com/xp-thebest/p/12641481.html