OSError: [Errno 22] Invalid argument: 'testx07lice.txt'

使用with open("textalice.txt","rt") as file_object:报上面的错误:

OSError: [Errno 22] Invalid argument: 'testx07lice.txt'

将上面的语句改成

with open(r"textalice.txt","rt") as file_object:

字符串前面加r,表示的意思是禁止字符串转义

原文地址:https://www.cnblogs.com/danniel-gong/p/12513029.html