回答編集履歴
2
コード修正
test
CHANGED
@@ -52,12 +52,16 @@
|
|
52
52
|
|
53
53
|
result = analyze_file(fin)
|
54
54
|
|
55
|
-
if not result:
|
56
55
|
|
56
|
+
|
57
|
+
if not result:
|
58
|
+
|
57
|
-
|
59
|
+
continue
|
58
60
|
|
59
61
|
|
60
62
|
|
61
|
-
|
63
|
+
with fout_path.open(mode='w') as fout:
|
64
|
+
|
65
|
+
fout.writelines(result)
|
62
66
|
|
63
67
|
```
|
1
追記
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
pathlibを使うとこんな感じです。
|
1
|
+
[pathlib](https://docs.python.jp/3/library/pathlib.html)を使うとこんな感じです。
|
2
2
|
|
3
3
|
```Python
|
4
4
|
|
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
for filename in parent_dir.glob('text*.txt'):
|
40
40
|
|
41
|
-
i = int(filename.name[4])
|
41
|
+
i = int(filename.name[4]) # 二桁以上の場合もあるならもうちょっと工夫が必要
|
42
42
|
|
43
43
|
|
44
44
|
|