0
내 코드가 작동하지 않는 이유가 확실하지 않습니다. 나는 강사로부터 축 어적으로 복사했습니다.출력이 예기치 않은 결과를내는 이유는 무엇입니까?
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()
그리고 출력 :
<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>
왜 이런 일이?
감사합니다.
텍스트 파일의 샘플 콘텐츠를 제공하시기 바랍니다. – albert
http://www.wdyl.com/ 유효한 장소가 아닙니다. –
WYDL은 (는) 더 이상 활성화되지 않습니다 : https://en.wikipedia.org/wiki/WDYL_(search_engine) – albert