我在D盘的temp目录里有一个文件a1.txt文件。我用下面的语句打开这个文件
fr=open('d:\temp\a1.txt','r')
fr=open('d:\temp\z1.txt','r'),又是可以的。因为没有\z转义字符
so the safety way to open file in python is using the following statements:
fr=open(R'D:\temp\a1.txt','r')
or
fr=open('d:\\temp\\a1.txt','r')