0

为什么我在写入文件时在控制台上得到输出?我不记得以前发生过这种情况...

outfile= open("C:\\Data\\testout.txt", 'w')
outfile.write("something")
outfile.write("something else")

输出:

9
14
4

1 回答 1

0

在 Python 版本 >3.0中,该write方法返回写入的字节数。

http://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects

于 2014-02-14T17:52:54.650 回答