2019-07-10 |

写入字节数

如果成功,则write方法返回写入文件的字节数。
msg = "Hello world!"
file = open("newfile.txt", "w")
amount_written = file.write(msg)
print(amount_written)
file.close()


Result:
>>>
12
>>>

0

发表评论

    评价:
    验证码: 点击我更换图片
    最新评论