how to set cookie in python mechanize
问题 After sending request to the server br.open('http://xxxx') br.select_form(nr=0) br.form['MESSAGE'] = '1 2 3 4 5' br.submit() I get the response title, which has set-cookie Set-Cookie: PON=xxx.xxx.xxx.111; expires=Tue, 17-Mar-2015 00:00:00 GMT; path=/ Because mechanize seems to be not able to remember the cookie, so I want to set cookie for br. How can I do it? cj = mechanize....? br.set_cookiejar(cj) I have no idea. Please help 回答1: I think that this should do what you want: import Cookie