Unten ist mein Python-Code, um Schimpfwörter in der Datei zu überprüfen. Aber ich bin nicht in der Lage zu finden, warum der Compiler Fehler zeigt: module 'urllib' has no attribute 'urlopen'
.Was ist falsch mit meiner Code-URL-Funktion?
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()
Welche Version von Python verwenden sollten, verwenden Sie? –