首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的输出会抛出一个意外的结果?

为什么我的输出会抛出一个意外的结果?
EN

Stack Overflow用户
提问于 2016-08-24 04:47:58
回答 1查看 59关注 0票数 0

我不确定为什么我的代码不能工作。我从我的讲师那里把它逐字抄了下来。

代码语言:javascript
复制
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()

和输出:

代码语言:javascript
复制
<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> was not found on this server.</h2>
    <h2></h2>
    </body></html>

为什么会发生这种情况?

谢谢你!!

EN

回答 1

Stack Overflow用户

发布于 2017-11-26 02:24:08

www.wdyl.com不再起作用了。

你可以使用你喜欢的:http://www.wdylike.appspot.com/?q=foo

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39110402

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档