Python,在.txt-fi中打开和编写

2024-09-30 10:28:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我收到以下错误消息:

io.UnsupportedOperation: not readable

根据此代码:

f=open('namn.txt', 'w')
namnnr=1
for rad in f.readlines():
    print(str(namnnr)+namnnr)
    namnnr+=1
    f.close()

为什么会这样?你知道吗


Tags: 代码iniotxt消息for错误not

热门问题