import requests import re r = requests.get("http://weibo.com/rmrb") p_nick = re.compile(r"CONFIG\['onick'\]='(.*?)'") m_nick = re.findall(p_nick,r.text) if len(m_nick) == 1: print m_nick[0] else: print "Not found!" #输出 #Not found!