I have this code in python 3.4
import urllib.request
def read_text():
document = open(r"C:\mystuff\udacity\pruebatxt.txt")
lec = document.read()
document.close()
print(lec)
check_profanity(lec)
def check_profanity (text_to_check):
print(text_to_check)
finally, i found the sollution by changing follow line
lecture = urllib.request.urlopen("http://www.wdyl.com/profanity?q="+ urllib.parse.quote(text_to_check))
output=lecture .read()
print(output)
lecture.close()
read_text()
And it gives me this error:
File "C:\Python34\lib\urllib\request.py", line 1159, in do_request_
raise URLError('no host given')
urllib.error.URLError: <urlopen error no host given>
What could be wrong?