import urllib.request, urllib.parse import http.cookiejar get_url = 'https://www.ilync.cn/login.do?fromurl=https%3A%2F%2Fwww.ilync.cn%2FiLync' cookie_filename = 'cookie.txt' cookie_aff = http.cookiejar.MozillaCookieJar(cookie_filename) cookie_aff.load(cookie_filename,ignore_discard=True,ignore_expires=True) handler = urllib.request.HTTPCookieProcessor(cookie_aff) opener = urllib.request.build_opener(handler) #使用cookie登陆get_url get_request = urllib.request.Request(get_url) get_response = opener.open(get_request) print(get_response.read().decode())