首页 > python在文件写入'w'操作后反馈提示Permission denied,这个是什么原因呢?

python在文件写入'w'操作后反馈提示Permission denied,这个是什么原因呢?

poem = '''\
I love you more than anything.
'''

f = open('text05.txt','w')    #提示[Error 13] Permission denied:'text05.txt'
f.write(poem)
f.close()

f = open('text05.txt')
while True:
    line = f.readline()
    if len(line) == 0:
        break
    print line, 

f.close()

看网上说是文件未关闭还在运行或是路径的问题,但还不太知所以然,具体解决的办法是什么呢,困扰许久啊。(处于windows平台上)


你写文件的权限不够


以管理员身份运行你的脚本

【热门文章】
【热门文章】