回答編集履歴

1

回答に追記

2018/10/24 14:58

投稿

y_waiwai
y_waiwai

スコア87774

test CHANGED
@@ -1 +1,21 @@
1
1
  1行づつ読むなら、readline (readlinesではない)を使えばどうでしょうか
2
+
3
+
4
+
5
+ ---
6
+
7
+ といいながらコピペ可能バージョン
8
+
9
+ ```python
10
+
11
+ with open(r'/home/yudai/poem.txt', encoding='utf-8') as f:
12
+
13
+ poems = f.readline()
14
+
15
+ while poems:
16
+
17
+ print (poems)
18
+
19
+ poems = f.readline()
20
+
21
+ ```