回答編集履歴
1
誤字とコメントを微修正
answer
CHANGED
@@ -34,13 +34,9 @@
|
|
34
34
|
|
35
35
|
```python
|
36
36
|
with open("st.txt", "w") as writer:
|
37
|
-
#ファイルに書き込む
|
38
37
|
writer.write("Hi from Python")
|
39
|
-
#ファイルを閉じる(withステートメント通過で自動で閉じられる)
|
40
38
|
|
41
|
-
#ファイルを操作するオブジェクトに「f」という名前を付けてst.txtファイルを開く
|
42
39
|
with open("st.txt", "r") as reader:
|
43
|
-
#ファイルを読み込んだ結果を変数に格納
|
44
40
|
my_list.append(reader.read())
|
45
41
|
|
46
42
|
```
|