Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
使用此最低信息,我无法为您提供很多帮助,但我建议您做类似的事情:
W+
替换为W
或a
(为了附加fout.txt
)。用于上下文,以确保当
out
脱离范围时,该文件已关闭,这有可能有助于使结果在文件中可见。这是一个有效的例子(在Python3中):
With this minimum information I can't help you a lot but I'll suggest you do something like this :
w+
with justw
ora
(to appendfout.txt
).with
is for context managing to be sure the file is closed whenout
goes out of scope, which can potentially help to make the result visible in the file.Here's a working example (in python3) :