回答編集履歴
1
プログラムの修正
test
CHANGED
@@ -2,15 +2,27 @@
|
|
2
2
|
|
3
3
|
```python
|
4
4
|
|
5
|
-
|
5
|
+
def remove(x):
|
6
6
|
|
7
|
-
|
7
|
+
lines.pop(x)
|
8
8
|
|
9
|
-
|
9
|
+
return lines
|
10
10
|
|
11
|
-
```python
|
12
11
|
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
with open(rfile) as f:
|
16
|
+
|
17
|
+
lines = f.readlines()
|
18
|
+
|
19
|
+
l_XXX_i = [i for i, line in enumerate(lines) if 'XXX' in line]
|
20
|
+
|
13
|
-
lines_after = list(map(
|
21
|
+
lines_after = list(map(remove, l_XXX_i))
|
22
|
+
|
23
|
+
with open(wfile, mode='w') as f:
|
24
|
+
|
25
|
+
f.writelines(lines_after)
|
14
26
|
|
15
27
|
```
|
16
28
|
|