EOL while scanning screen literal when using urllib.urlopen (PYTHON) -
guys, i'm learning python , i've written program:
import urllib def read_text(): quotes = open(r"c:\moviequotes\moviequotes.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(r"http://www.wdyl.com/profanity?q="+text_to_check") output = connection.read() print(output) connection.close() read_text()
i'm getting error: eol while scanning string literal. doing wrong? file:
-- houston, have problem. (apollo 13) -- mama said, life box of chocolates. never know going get. (forrest gump) -- cant handle truth. (a few men) -- believe , believe nothing. (a shot in dark)
exchange:
connection = urllib.urlopen(r"http://www.wdyl.com/profanity?q="+text_to_check")
with
connection = urllib.urlopen(r"http://www.wdyl.com/profanity?q="+text_to_check)
you have double quotes.
Comments
Post a Comment