用正则表达式匹配出来的;

# 获取表单VIEWSTATE,EVENTVALIDATION的值 参数r是html

def get_VIEWSTATE(r):
pattern1=r'VIEWSTATE\".*value=\".*\"'
match=re.search(pattern1,r).group(0);
pattern2=r'VIEWSTATE\" id=\"__VIEWSTATE\" value=\"'
match1=re.split(pattern2,match);
return match1[1][:-1]; #返回_VIEWSTATE

def get_EVENTVALIDATION(r):
pattern1=r'EVENTVALIDATION\".*value=\".*\"'
match=re.search(pattern1,r).group(0);
pattern2=r'EVENTVALIDATION\" id=\"__EVENTVALIDATION\" value=\"'
match1=re.split(pattern2,match);
return match1[1][:-1]; #返回_EVENTVALIDATION

#############################