python - 如何将 python3 用于 profantiy 编辑器迷你项目?
问题描述
[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() 文件“C:\Users\simra\AppData\Local\Programs\Python\Python37-32\profanityeditor.py”,第 6 行,在 text_finder 亵渎(内容)中文件“C:\Users\simra\AppData\Local\Programs\Python\Python37-32\profanityeditor.py”,第 9 行,亵渎连接=urllib.request.urlopen(" http://www.wdylike.appspot。 com/?q="+text_to_check) 文件 "C:\Users\simra\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py",第 222 行,在 urlopen 返回 opener.open(url, data, timeout)文件“C:\Users\simra\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py”,第 531 行,打开响应 = meth(req, response) 文件“C:\Users\ simra\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py",第 641 行,在 http_response 'http'、请求、响应、代码、msg、hdrs) 文件“C:\Users\simra \AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py”,第 569 行,错误返回 self._call_chain(*args) 文件“C:\Users\simra\AppData\Local\Programs\ Python\Python37-32\lib\urllib\request.py”,第 503 行,在 _call_chain 结果 = func(*args) 文件“C:\Users\simra\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py”,第 649 行,在 http_error_default 中引发 HTTPError(req.full_url , 代码, msg, hdrs, fp) urllib.error.HTTPError: HTTP 错误 404: 未找到
解决方案
推荐阅读
- php - 如果附件很大,phpmailer会突然停止
- python - 修复“检查天气,您的 Graph def 解释二进制文件是否与您的 Graph def 生成二进制文件是最新的”
- react-native - React-Native如何在点击释放时仅触发对TouchableOpacity的点击
- html - 在不使用任何属性的情况下使用 css 获取元素
- mysql - 使用 join 和 group by 在 1 行中组合 2 个表
- c# - 为什么我在使用 MongoDB 时出现 E11000 重复键错误
- selenium - 如何在 testNG 中使用组
- javascript - 如何根据页面大小调整按钮图标的大小
- javascript - 在Javascript中将具有未知路径的嵌套Json值推送到数组中
- arrays - 传递 slice 作为参考以反映调用者的变化