import requests import re import string cookie = {'Cookie' : 'wctf_think_language=zh-CN;PHPSESSID=ltbxxxxxxxxxxxxxxxxxxxxfl6'} r = requests.get("http://ctf.idf.cn/game/pro/37/", cookies = cookie) text = re.search(r'<hr />\s(.*)\s<hr />', r.text, re.S).group(1) res = "" res += str(text.count('w')) res += str(text.count('o')) res += str(text.count('l')) res += str(text.count('d')) res += str(text.count('y')) print(res) payload = {'anwser':res} r = requests.post("http://ctf.idf.cn/game/pro/37/", cookies = cookie, data = payload) print(r.text)