回答編集履歴
1
読み込み処理追加
answer
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
+
書き込み
|
2
|
+
|
1
3
|
```python
|
2
4
|
with open("count.txt", "w") as f:
|
3
5
|
print(count, file=f)
|
6
|
+
```
|
7
|
+
|
8
|
+
読み込み
|
9
|
+
|
10
|
+
```python
|
11
|
+
try:
|
12
|
+
with open("count.txt") as f:
|
13
|
+
count = int(f.read().strip())
|
14
|
+
except (FileNotFoundError, ValueError):
|
15
|
+
count = 0
|
4
16
|
```
|