[This is the error output.][1]I've tried using urllib.parse also to parse the value but nothing helps.Please help me out. I'm a beginner in Python.
import urllib.request
def text_finder():
songs=open("C:\song.txt")
contents=songs.read()
songs.close()
profanity(contents)
def profanity(text_to_check):
connection=urllib.request.urlopen("http://www.wdylike.appspot.com/?q="+text_to_check)
output=connection.read()
connection.close()
if "true" in output:
print("No curse word in text.")
elif "false" in output:
print("There is curse word in your text!")
else:
print("Something went wrong!")
text_finder()
这是错误消息输出。 请帮帮我。 重新启动:C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ profanityeditor.py 追溯(最近一次通话): 文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ profanityeditor.py”,第18行,在 text_finder() 在text_finder中,文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ profanityeditor.py”,第6行 亵渎(内容) 文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ profanityeditor.py”,第9行,亵渎 connection = urllib.request.urlopen(“ http://www.wdylike.appspot.com/?q=” + text_to_check) urlopen中的文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第222行 返回opener.open(URL,数据,超时) 打开的文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第531行 响应= meth(req,响应) 文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第641行,位于http_response中 'http',请求,响应,代码,msg,hdr) 文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第569行,错误 返回self._call_chain(* args) _call_chain中的文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第503行 结果= func(* args) 文件“ C:\ Users \ simra \ AppData \ Local \ Programs \ Python \ Python37-32 \ lib \ urllib \ request.py”,第649行,位于http_error_default中 引发HTTPError(req.full_url,code,msg,hdrs,fp) urllib.error.HTTPError:HTTP错误404:未找到