這是我一直在使用的代碼,它只是不斷出現錯誤,我使用Python 2.7和建議或幫助將是非常有益的。我想如何搜索raw_input中的特定單詞?
print "What is your mobile problem?"
print "----------------------------"
problem = raw_input
if "dropped" in problem
print "sdghsd"
elif "broken" in problem
print "sdfghf"
你在'if'和'elif'條件後缺少冒號(':')......這是Python語法的基本部分。另外,它是Python 2.7中的'raw_input()',而不是'raw_input'。否則,你的搜索字符串條目的邏輯是合理的。 – blacksite