我正在開發一個允許用戶輸入查詢的Python故障排除應用程序。此查詢將包含設備的品牌以及問題的症狀或問題。我正在編寫一個腳本,它基本上對查詢進行剖析,以便根據設備的關鍵字和品牌找到適當的解決方案。用於查詢選擇的內聯用戶數據輸入操作| Python
目前代碼: #IMPORT模塊 進口警告
#Define Globals
brands = ["apple", "android", "windows"]
brand = ''
def Main():
init()
print("--Welcome to Troubleshooting Applet--")
print("In your query please include the brand of your device and the problem/symptom of your current issue. \n")
query = input("Enter your query: ").lower()
brand = set(brands).intersection(query.split())
if brand != '':
print(brand)
else:
print("Brand in existance not defined")
def init():
#warnings.filterwarnings("ignore") #Disable while debugging
if __name__ == '__main__':
Main()
目前,該腳本將確定一個品牌,但我不如何才能跟隨檢查寬一些關鍵字一定解決途徑。我希望解決方案能夠按照選擇一個品牌的特定品牌的次要陣列的模式,其中包含一些潛在的錯誤。每個錯誤都可以定義一個解決方案。
我將不勝感激任何見解,
感謝,
山姆
嘿,我其實不太擅長Python。我怎樣才能在我的口譯員中運行?我目前得到這個錯誤信息:「SyntaxError:編譯單個語句時發現多個語句」。 – gordlonious
嗨Gordlonious,我一直在Python Shell v3.5.2中運行它。我希望這是最明顯的錯誤。謝謝你的幫助,這是非常感謝,山姆:-) –