#coding:gbk
import os,sys,time,ctypes
def main():
argc = len(sys.argv)
filename = r"d:\a.txt"
try:
os.remove(filename)
print "删除文件成功"
#except WindowsError as e: #同下一行
except WindowsError,e:
#print ctypes.GetLastError()
#print os.strerror(e.errno)
if e.errno==2:
print "文件不存在"
finally:
pass
if __name__ == '__main__':
main()
#查看错误号:http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx