Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -198,12 +198,12 @@ def merge_lines(doc1, doc2, doc3, doc4):
|
|
198 |
docs = [doc1, doc2, doc3, doc4]
|
199 |
merged_lines = []
|
200 |
|
201 |
-
with open("merged_lines.txt", "w") as f
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
|
208 |
return merged_lines
|
209 |
|
|
|
198 |
docs = [doc1, doc2, doc3, doc4]
|
199 |
merged_lines = []
|
200 |
|
201 |
+
with open("merged_lines.txt", "w") as f, \
|
202 |
+
*map(open, docs) as handles:
|
203 |
+
for lines in zip(*handles):
|
204 |
+
merged_line = "".join(line.strip() for line in lines)
|
205 |
+
f.write(merged_line + "\n")
|
206 |
+
merged_lines.append(merged_line)
|
207 |
|
208 |
return merged_lines
|
209 |
|