ami / finalize.py
patrickvonplaten's picture
up
28e6c6f
raw
history blame contribute delete
528 Bytes
#!/usr/bin/env python3
import sys
transcript = sys.argv[1]
new_transcript = sys.argv[2]
def right_fill(string):
return str(int(100 * float(string))).rjust(7, "0")
ref_look_up_dict_end = {}
with open(transcript, "r") as f, open(new_transcript, "w") as g:
ref_lines = f.readlines()
for line in ref_lines:
items = line.split(" ")
line_1 = "AMI_" + "_".join(items[:3]) + "_" + "_".join([right_fill(i) for i in items[3:5]])
line_2 = " ".join(items[5:])
g.write(line_1 + " " + line_2)