我對編程和python非常陌生。我正在編寫腳本,如果客戶輸入空格,我想退出腳本。 問題是我該怎麼做對不對? 這是我的嘗試,但我認爲是錯誤的如何檢查python中的空格輸入
例如
userType = raw_input('Please enter the phrase to look: ')
userType = userType.strip()
line = inf.readline()
while (userType == raw_input)
print "userType\n"
if (userType == "")
print "invalid entry, the program will terminate"
# some code to close the app