[post] new post
All checks were successful
/ deploy (push) Successful in 2m42s

This commit is contained in:
SouthFox 2024-05-21 23:30:08 +08:00
parent 04a093c576
commit d6f2c8c3aa

View file

@ -0,0 +1,14 @@
+++
title = 2024-05-21
author = ["SouthFox"]
date = 2024-05-21T23:25:00+08:00
lastmod = 2024-05-21T23:28:08+08:00
tags = ["publish"]
draft = false
+++
## Python 既读又写 {#python-既读又写}
[python]({{< relref "../main/20240521232625-python.md" >}}) 中 open 函数为 `r+` 模式时为即读又能写,但是读完整个文件后
文件位置将处于最末尾,这时写入相当于追加写,需要使用 seek(0) 重新将
文件位置置于开头。