Created
August 8, 2017 14:54
-
-
Save pingswept/85cbb6dc905fb34cce68a449061d2e37 to your computer and use it in GitHub Desktop.
Script for Chris to manipulate his G-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infile = "infile.txt" # the file to open | |
copies = 3 # how many copies to make | |
marker = "STARTHERE\n" | |
with open(infile, 'r') as infile: | |
lines = infile.readlines() | |
#print(lines) | |
startline = lines.index(marker) | |
result = ''.join(lines + (lines[startline + 1:] * copies)) | |
with open('output.txt', 'w') as outfile: | |
outfile.write(result) | |
#print result | |
outfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment