This commit is contained in:
parent
04a093c576
commit
d6f2c8c3aa
1 changed files with 14 additions and 0 deletions
14
content/posts/2024-05-21.md
Normal file
14
content/posts/2024-05-21.md
Normal 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) 重新将
|
||||||
|
文件位置置于开头。
|
Loading…
Reference in a new issue