dimanche 22 février 2015

how to compare two strings in python while one of the two stings are taken from gui i/p?


import easygui
count = 0
dish = easygui.enterbox("enter your favourite dish:")
with open("menu.txt") as f:
content = f.readlines()
for item1 in content:
if item1 == dish :
easygui.msgbox("order taken.thankyou")
count = count + 1
continue
if count == 0 :
easygui.msgbox("plz order some other item")


my menu.txt is:



apple

banana

orange

grape

mango


my input in gui(enterbox) is :



orange


whats wrong in my code? the o/p im getting is not found every time,since it is not able to compare two strings.


plz help me where i went wrong?


Aucun commentaire:

Enregistrer un commentaire