python - Why is my output throwing an unexpected result? -


i unsure why code not working. have copied verbatim instructor.

import urllib  def read_text():     quotes = open("c:\users\kyle\desktop\movie_quotes.txt")     contents_of_file = quotes.read()     print(contents_of_file)     quotes.close()     check_profanity(contents_of_file)   def check_profanity(text_to_check):     connection = urllib.urlopen("http://www.wdyl.com/profanity?q="+text_to_check)     output = connection.read()     print(output)     connection.close()  read_text() 

and output:

<html><head>     <meta http-equiv="content-type" content="text/html;charset=utf-8">     <title>404 not found</title>     </head>     <body text=#000000 bgcolor=#ffffff>     <h1>error: not found</h1>     <h2>the requested url <code>/profanity?q=shot</code> not found on server.</h2>     <h2></h2>     </body></html> 

why happening?

thank you!!

www.wdyl.com doesn't work anymore.

you can use instead: http://www.wdylike.appspot.com/?q=foo


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -