via http://whoop.sinaapp.com/download/weibo-login/ 成功后直接会print title,然后该干嘛干嘛去 #coding=utf8 import urllib2 import re """ Login to Sina Weibo with cookie """ COOKIE = '' #fill with your weibo.com cookie HEADERS = {"cookie": COOKIE} def test_login(): url = 'http://weibo.com' req = urllib2.Request(url, headers=HEADERS) text = urllib2.urlopen(req).read() pat_title = re.compile('(.+?)') r = pat_title.search(text) if r: print r.group(1) if __name__ == '__main__': test_login()