python - profanity editor tutorial gives me a traceback not sure why -


i following along tutorial learn python , traceback while following along video not sure messed can please me , point out messed up, gave taceback code format make more appealing easier read not sure if helps

the traceback is:

c:\users\jay\appdata\local\programs\python\python36-32\python.exe c:/users/jay/pycharmprojects/udacity_python_course/profanity_editor.py     traceback (most recent call last):     -- houston, have problem. (apollo 13)       file "c:/users/jay/pycharmprojects/udacity_python_course/profanity_editor.py", line 34, in <module>          read_text()     -- mama said, life box of chocolates. never know going get. (forrest gump)       file "c:/users/jay/pycharmprojects/udacity_python_course/profanity_editor.py", line 20, in read_text          check_profanity(content_of_file) #call function check profanity read file     -- cant handle truth. (a few men)        file "c:/users/jay/pycharmprojects/udacity_python_course/profanity_editor.py", line 28, in check_profanity     -- believe , believe nothing. (a shot in dark)         connection = urllib.urlopen("www.wdylike.appspot.com/?q="+text_to_check)     attributeerror: module 'urllib' has no attribute 'urlopen 

the code is:

#we want program read text document #check text bad words   #create function called read text fist thing read text #def used create function , function must have (): #the open function in python takes address of file want open # read python functionality under open function , lets read file in open #need use r open file or wont open import urllib   def read_text():     quotes = open(r"c:\users\jay\pycharmprojects\movie_quotes.txt")     content_of_file = quotes.read()     print(content_of_file)     quotes.close()     check_profanity(content_of_file) #call function check profanity read file #read text file complete  #start of part 2 check text bad words  def check_profanity(text_to_check):     #going use urlib python moduel helps informaton internet     #urlib has function in called  urlopen takes link website     connection = urllib.urlopen("www.wdylike.appspot.com/?q="+text_to_check)     output = connection.read() #read above output     print(output)     connection.close()   read_text() 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -