Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import sys
- lines = []
- with open(sys.argv[1], "rt") as input:
- with open(sys.argv[2], "r") as template:
- for line in input:
- lineArray = line.split('\t')
- lines.append(lineArray);
- templateText = template.read()
- for index, line in enumerate(lines):
- id = ""
- if index == 0:
- continue
- out = templateText
- for line_index, val in enumerate(line):
- if lines[0][line_index] == "ID":
- id = val
- temp = templateText
- key = "<<" + lines[0][line_index].strip() + ">>"
- out = out.replace(key, val)
- with open(f"{id}.txt", "w") as output:
- output.write(out)
- print("done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement