質問編集履歴
1
コード変更とエラー表示の詳細
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,3 +35,59 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
コードを書き直しましたが、エラーが表示されてしまいます。
|
42
|
+
|
43
|
+
```python
|
44
|
+
|
45
|
+
import sys
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
file = sys.argv
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
file1 = file[1]#これが読み込むファイル
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
file1 = open(file[1],'w')
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
lines = []
|
62
|
+
|
63
|
+
lines = file1.readlines()
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
for i in lines:
|
72
|
+
|
73
|
+
if not lines.startswitch("#"):
|
74
|
+
|
75
|
+
print(lines)
|
76
|
+
|
77
|
+
else:
|
78
|
+
|
79
|
+
print('')
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
エラー内容
|
86
|
+
|
87
|
+
Traceback (most recent call last):
|
88
|
+
|
89
|
+
File "ex04_4.py", line 16, in <module>
|
90
|
+
|
91
|
+
lines = file1.readlines()
|
92
|
+
|
93
|
+
io.UnsupportedOperation: not readable
|