Skip to content

Instantly share code, notes, and snippets.

@blurbdust
Created September 12, 2019 17:57
Show Gist options
  • Save blurbdust/d1812471944d3bf61bbab857343c042c to your computer and use it in GitHub Desktop.
Save blurbdust/d1812471944d3bf61bbab857343c042c to your computer and use it in GitHub Desktop.
minimum of 15 charcters from kwp
#!/env/user/python3
import sys
def main(infile, outfile, minlength):
#print(minlength)
minlength = int(minlength)
with open(outfile, "w") as out:
with open(infile, "r") as in_:
for line in in_:
line = line.replace("\n", "").replace("\r", "").replace("\t", "").replace(" ", "")
sum = 1
for char in line:
sum += int("0x" + char, 16)
if (sum >= minlength):
#print(line)
out.write(line + "\n")
if __name__ == '__main__':
if len(sys.argv) < 3:
print("Useage: {} input_route modified_route minlnegth".format(sys.argv[0]))
else:
main(sys.argv[1], sys.argv[2], sys.argv[3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment