/logo.webp

urllib库的基本使用

网页各种测试 1 http://httpbin.org 获取一个get请求 1 2 3 import urllib.request res = urllib.request.urlopen("http://www.baidu.com") print(res.read().decode('utf-8')) # 对获取到的网页源码进行utf-8解码 获取一个post请求.(模拟用户登录) 1 2 3 4 import urllib.parse