###
cookies = "vaptchaNetway=cn; Hm_lvt_337e99a01a907a08d00bed4a1a52e35d=1628248083,1629106799; " \ "sessionid=g1siko0evn5hmnn3pbgl0vaoqjx29cfo; Hm_lpvt_337e99a01a907a08d00bed4a1a52e35d=1629124377" # 不使用字典推导式的写法 cookie_list = cookies.split(";") cookie_dict = {} print(cookie_list) for cookie in cookie_list: cookie_dict[cookie.split("=")[0].strip()] = cookie.split("=")[1].strip() print(cookie_dict) # 使用字典推导式的写法 print({cookie.split("=")[0].strip():cookie.split("=")[1].strip()for cookie in cookies.split(";")})
###
###