Created
May 26, 2022 13:02
-
-
Save wardbeyens/c78a9e449a7fdc5758e0d4ca51d30227 to your computer and use it in GitHub Desktop.
TextUITester terminal to input file converter
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
dateStringToReplace = "18/03/2022 at 9:52" | |
input = open("input.txt", "r") | |
lines = input.readlines() | |
newlines = ["Ejava -cp target/classes be.kuleuven.assemassit.App\n"] | |
i = 0 | |
while i < len(lines): | |
nextline = "" | |
if(i < (len(lines)-1)): | |
nextline = lines[i+1] | |
line = lines[i] | |
lineData = line.strip("\n") | |
newLine = "" | |
if(nextline == "\n" and line == "\n"): | |
print(i) | |
newLine = "<" + "\\n" + "\n" | |
elif (lineData.isnumeric() or line == "-1\n"): | |
newLine = "<" + line | |
else: | |
newLine = ">" + line | |
if(newLine.find(dateStringToReplace) > 0): | |
newLine = newLine.replace(dateStringToReplace, "%" + "date" + "%") | |
newlines.append(newLine) | |
i += 1 | |
newlines[-1] += "\n" | |
newlines.append("X0\n") | |
output = open('output.txt', 'w+') | |
output.writelines(newlines) | |
output.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment