代码如下:
file=open('cake.txt','w')
出现以下情况:
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
open('cake.txt','w')
TypeError: an integer is required (got type str)
这种语法在 3.6 版本上完美运行,现在我升级到 3.7 它没有。这里发生了什么?顺便说一句,“cake.txt”文件不存在。
python文档也没有帮助。