Discuss / Python / 写文件时有点小问题

写文件时有点小问题

_CindyL_

#1 Created at ... [Delete] [Delete and Lock User]

为什么我写文件时会返回内容的长度?而且文件里面并没有写入任何内容?

>>> file=open('/Users/xxx/Desktop/abc.txt','w')
>>> file.write('hello,world!')
12

_CindyL_

#2 Created at ... [Delete] [Delete and Lock User]

已经解决了,原来我要关掉文件才能往里面写内容。


  • 1

Reply