回答編集履歴

1

1列目のファイル名をつける部分を修正しました。

2022/03/28 06:30

投稿

退会済みユーザー
test CHANGED
@@ -1,5 +1,11 @@
1
1
 
2
2
  次のような感じではどうでしょうか。
3
+
4
+ ごめんなさい、コードに誤りがありました・・
5
+ (1列目のファイル名をつける部分をスルーしてしまいました)
6
+
7
+ `text2 = '\n'.join(array2) + '\n'`を
8
+ `text2 = '\n'.join(array3) + '\n'`に修正しました。
3
9
 
4
10
  ```py
5
11
  # coding=utf-8
@@ -16,7 +22,7 @@
16
22
  array1 = text1.splitlines()
17
23
  array2 = array1 if files.index(file) == 0 else array1[header_length:]
18
24
  array3 = [basename + ',' + x for x in array2]
19
- text2 = '\n'.join(array2) + '\n'
25
+ text2 = '\n'.join(array3) + '\n'
20
26
  merged_text += text2
21
27
 
22
28
  merged_filename = "結合テキスト.txt"