Skip to content

Commit

Permalink
fix line return (#531)
Browse files Browse the repository at this point in the history
`len(data)` is the size of json object parsed from a line, which does
not represent the count of lines in the source file. This incorrectly
squashes most contents of the input file to the second line of the
output file.

---------

Co-authored-by: Yunfan Zhong <alanwake@in.ai>
  • Loading branch information
fantasist and Yunfan Zhong authored Jul 19, 2024
1 parent a9dd435 commit b84fa39
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def process_file(input_file_path, output_file_path):
with open(output_file_path, "w") as f:
for i, modified_line in enumerate(modified_data):
f.write(modified_line)
if i < len(modified_data) - 1:
f.write("\n")
if i < len(lines) - 1:
f.write("\n")

print(f"All placeholders have been replaced for {input_file_path} 🦍.")


Expand Down

0 comments on commit b84fa39

Please sign in to comment.