为什么会发生这个NameError?

时间:2018-05-03 03:17:26

标签: python-3.x

我目前正在通过Udacity学习Python,它为check_profanity提供了一个NameError,我不确定为什么

import urllib


def read_text():
    quotes = open("C:\\Udacity Python\\Lesson 4\\movie_quotes.txt", "r")
    contents = quotes.read()
    print(contents)
    quotes.close()
    check_profanity(contents)


read_text()


def check_profanity(contents_of_file):
    text_to_check = read_text.contents_of_file
    connection = urllib.urlopen(
        "http://www.wdylike.appspot.com/?q="+text_to_check)
    output = connection.read()
    print(output)
    connection.close()


check_profanity()

0 个答案:

没有答案