From 4ae70d5c2e21d3fe1631caf0d22369b07288062b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E4=BC=A0=E6=95=8F?= <2509165031@student.example.com> Date: Mon, 16 Mar 2026 17:37:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my_requests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 my_requests.py diff --git a/my_requests.py b/my_requests.py new file mode 100644 index 0000000..43cb40b --- /dev/null +++ b/my_requests.py @@ -0,0 +1,10 @@ +import requests +url='https://www.baidu.com' +params={'key':'value'} +response=requests.get(url,params=params) +if response.status_code==200: + html_content=response.text + print("请求成功,获取到HTML内容") +else: + print(f"请求失败,状态码:{response.status_code}") +