How to save mechanize.Browser() cookies to file?
How could I make Python's module mechanize (specifically mechanize.Browser()) to save its current cookies to a human-readable file? Also, how would I go about uploading that cookie to a web page with it? Thanks jizhilong Deusdies,I just figured out a way with refrence to Mykola Kharechko's post #to save cookie >>>cookiefile=open('cookie','w') >>>cookiestr='' >>>for c in br._ua_handlers['_cookies'].cookiejar: >>> cookiestr+=c.name+'='+c.value+';' >>>cookiefile.write(cookiestr) #binding this cookie to another Browser >>>while len(cookiestr)!=0: >>> br1.set_cookie(cookiestr) >>> cookiestr