代码:
import os;
o=open("i:\pycode\mylog.txt");
content=o.read(16);
print content;
o.close();
if os.path.exists("i:\pycode\mylog.txt"):
os.remove("i:\pycode\mylog.txt");
print "The file have been deleted!";
出错结果:
Traceback (most recent call last):
File "I:\pycode\PythonApplication1\PythonApplication1\osfile.py", line 7, in <module>
os.remove("i:\pycode\mylog.txt");
WindowsError: [Error 32] : 'i:\\pycode\\mylog.txt'
>>>
这样的问题如何处理?