就像@robert所说的那样,使用机械化。
为了帮助您入门:
from mechanize import Browserb = Browser()b.open("http://forum.ubuntu-it.org/index.php")b.select_form(nr=0)b["user"] = "johnconnor"b["passwrd"] = "hellohello"b.submit()response = b.response().read()if "Salve <b>johnconnor</b>" in response: print "Logged in!"


