这是我的功能:
def read_text():
quotes = open("C:\blop\movie_quotes.txt")
contents_of_file = quotes.read
print(contents_of_file)
quotes.close
read_text()
Run Code Online (Sandbox Code Playgroud)
我只是想读取文件并在文件中打印文本,但是我收到此错误:
Traceback (most recent call last):File "C:/Python27/detect_profanity.py", line 6, in <module>
read_text()File "C:/Python27/detect_profanity.py", line 2, in read_text
quotes = open("C:\blop\movie_quotes.txt")
IOError: [Errno 22] invalid mode ('r') or filename: 'C:\x08lop\\movie_quotes.txt'
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
python ×1