嗨所以當我加入它開始給我的Python 2.7.8預期的縮進塊的幫助,請
IndentationError: expected an indented block
的,而真實的陳述的任何你們知道如何解決它困擾着我:/
import urllib
import urllib2
count = 0
while True:
var = raw_input("Please enter a username: ")
print "you entered", var
print "now starting"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0',
'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
}
url = "http://example.com"
params = urllib.urlencode({'strUsername': var})
req = urllib2.Request(url, params)
count + 1
req.addheaders = [(headers)]
page = urllib2.urlopen(req).read()
if page.find("success"):
print "Username Checked:", var, count
請爲您的代碼行添加空格,以便將其顯示爲代碼。 – 2014-08-27 10:04:51
啊好吧對不起,我想知道爲什麼它不會顯示lulz – Reptic 2014-08-27 10:05:20
@Reptic:'count + 1'不是你想要的。你需要'count = count + 1'或'count + = 1'。 (請在這裏停止使用街頭俚語) – Matthias 2014-08-27 15:54:03