自己搞定了,代码如下,希望大家指正 #coding=utf-8 import requests url = 'http://www.baidu.com' f=open(r'cookies.txt','r') cookies={} for line in f.read().split(';'): #其设置为1就会把字符串拆分成2份 name,value=line.strip().split('=',1) cookies[name]=value r = requests.get(url, cookies=cookies)