回答編集履歴
1
プログラムの修正
answer
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
このようにしたら行けるはずです。
|
2
2
|
```python
|
3
|
+
def remove(x):
|
4
|
+
lines.pop(x)
|
5
|
+
return lines
|
6
|
+
|
7
|
+
|
8
|
+
with open(rfile) as f:
|
9
|
+
lines = f.readlines()
|
10
|
+
l_XXX_i = [i for i, line in enumerate(lines) if 'XXX' in line]
|
3
|
-
lines_after =
|
11
|
+
lines_after = list(map(remove, l_XXX_i))
|
12
|
+
with open(wfile, mode='w') as f:
|
13
|
+
f.writelines(lines_after)
|
4
14
|
```
|
5
|
-
から
|
6
|
-
```python
|
7
|
-
lines_after = list(map(lines.pop,l_XXX_i))
|
8
|
-
```
|
9
15
|
※前提条件
|
10
16
|
l_XXX_iのリストの中身がすべてint型の場合のみ実行可能
|
11
17
|
str=>intへの変換方法
|