FileNotFoundError: [Errno 2] No such file or directory
代码如下
filehand =
open
(
'd:/file/ads.txt'
,
'w'
)
filehand.write(
'abcd'
)
filehand.close()
原因:d盘下午file文件夹,w模式在没有ads.txt时会自动创建该文件,但不会创建文件夹。