[Tutor] Please help, the program is not behaving as I want

I. Dooba idooba at gmail.com
Tue May 17 17:20:43 CEST 2011


I'm new to programming and have decided to start with Python following the
advice of experts including Eric S. Raymond.
So far I've learnt quite a lot from this list.

However, I've the following problem.

The program was designed (as part of my practice with Head First
Programming) to check whether an ingredient is Halal or Haram.
I've a simple table online where some ingredients are either halal or
 haram.

For example, if the user enters "water" the program is supposed to tell him
that it's halal;
but it's returning ">" and other characters I don't want to see.

What am I doing wrong?

import urllib.request

page = urllib.request.urlopen("http://halalingredients.theparleyonline.com/
")
text = page.read().decode("utf8")

halal_haram_status = text.find(input("Enter the ingredient:  "))
begin_final_status = halal_haram_status + 3
end_final_status = begin_final_status + 5
status = text[begin_final_status:end_final_status]
print(status)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110517/c8bfc196/attachment.html>


More information about the Tutor mailing list