다음은 파일의 저주 단어를 확인하는 파이썬 코드입니다. 하지만 왜 컴파일러 오류를 표시 찾을 수 없습니다 : module 'urllib' has no attribute 'urlopen'
.내 코드 urlopen 함수에 어떤 문제가 있습니까?
import urllib
def read_txt():
quote = open("c:\\read.txt") #for opening the file
content = quote.read() #for reading content in a file
print(content)
quote.close() #for closing the file
check_profanity(content)
def check_profanity(text):
connection = urllib.urlopen("https://www.wdylike.appspot.com/?q=" + text)
ouput = connection.read()
print(output)
connection.close()
read_txt()
를 사용해야 동안
는 Python2에서당신은
urllib2
사용해야합니까? –