Skip to content

Commit

Permalink
Merge pull request #201 from pyconjp/ISSHA-2735
Browse files Browse the repository at this point in the history
ISSHA-2735 クローズ処理の位置を変更してファイル出力されるように修正した
  • Loading branch information
ryu22e committed Apr 22, 2023
2 parents 63a80dc + 1310515 commit 0d86c15
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions source/textbook/5_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ Pythonでファイルを開くには `open()` 関数を使います。
12
```

{numref}`file-open`、{numref}`write-string` の結果、実行環境直下に `pycamp.txt` というファイルが次のような内容で作成されます。

```{code-block} none
:caption: "新規作成されたpycamp.txtの内容"
Hello Python
こんにちはPython
```

```{index} close() single: File; close()
```

Expand All @@ -91,12 +82,24 @@ Hello Python

ファイルを閉じるには、ファイルオブジェクトの `.close()` メソッドを呼び出します。

(file-close)=

```{code-block} pycon
:caption: "ファイルを閉じる"
>>> f.close()
```

{numref}`file-open`、{numref}`write-string`、{numref}`file-close` の結果、実行環境直下に `pycamp.txt` というファイルが次のような内容で作成されます。

```{code-block} none
:caption: "新規作成されたpycamp.txtの内容"
Hello Python
こんにちはPython
```


```{index} read() single: File; read()
```

Expand Down

0 comments on commit 0d86c15

Please sign in to comment.