回答編集履歴
1
Proof of conceptを追加
test
CHANGED
@@ -55,3 +55,43 @@
|
|
55
55
|
names.append(line.rstrip('\r\n'))
|
56
56
|
|
57
57
|
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
---
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
Proof of concept:
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
```python
|
70
|
+
|
71
|
+
with open('text.txt') as f:
|
72
|
+
|
73
|
+
names = [line.rstrip('\r\n') for line in f]
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
Name = ["良子", "Ingram", "Emi", "山田さん", "佐藤さん"]
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
print(names == Name)
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
$ python text.py
|
90
|
+
|
91
|
+
True
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
以上のとおり、テキストから読み込んだリストと、ハードコードされたリスト(Name)が同一であることが確認できます。
|