try
:
fh
=
open
(
"testfile"
,
"w"
)
fh.write(
"测试文件,用于测试异常!!"
except
IOError:
print
"Error: 不可写入"
else
"文件写入成功"
fh.close()